The parameters of QT reference com components don't match
Time:09-18
Project must refer to mitsubishi com components, to read and write the hardware buffer, using MFC add ActiveX reference everything is normal, now project must be to do with QT, dumpcpp is used to derive the h and CPP, function declaration was not the same as in the MFC, such as one connected to read the content of the n word function in MFC is
long ReadDeviceBlock2 (LPCTSTR szDevice, long lSize, short * lpsData);
QT export is
int ReadDeviceBlock2 (QString szDevice, int lSize, int& LpsData);;
now the question is: QT inside when using lSize can only fill in 1, otherwise to heap outside not write error; MFC under short * lpsData can point to a buffer in a row, a read hundreds of words is no problem, QT became int& inside; LpsData WTF? I can only read one word at a time, I met for a few hundred words to hundreds of times, time can afford ah, now I don't know how to solve, ask god to help ah
CodePudding user response:
How do you write IDL Use OLEView look
CodePudding user response:
Don't int& LpsData, is to save the address of a memory area in the past, int addr=(int) (& amp; Memory area), the addr in the past, the original poster ever tried