我通过类型 VARIANT * var 的c ++ invoke(...)方法得到结果。 var 是 .bmp 图片。
qDebug() << var.vt; //8209 ~ VT_ARRAY|VT_UI1 ~ SAFEARRAY(BYTE)
如何将它从SAFEARRAY(BYTE)转换为QByteArray?或者如何获得QImage(QPixmap,QBitmap)?由于/.
答案 0 :(得分:2)
long iLBound, iUBound;
char * data;
SafeArrayGetLBound(AFingerImage.parray, AFingerImage.parray->cDims, &iLBound);
SafeArrayGetUBound(AFingerImage.parray, AFingerImage.parray->cDims, &iUBound);
SafeArrayAccessData(AFingerImage.parray,(void**)(&data));
long sz = iUBound - iLBound + 1;
QByteArray ba = QByteArray::fromRawData(data,sz);
FPImage.loadFromData(ba);
SafeArrayUnaccessData(AFingerImage.parray);