View Full Version : Using array with QAxWidget::dynamicCall() function

17th May 2010, 10:30
Hi there!

I have the following problem: when calling this function

QAxWidget *dataq;
// more code, i is the number of values to read
QList<QVariant> res_array;
for (int j=0; j<i; j++)
dataq->dynamicCall("GetDataEx(int&, int)", res_array, i );

it crashes with the following error:

Heap block at 0980F7A0 modified at 0980F7AA past requested size of 2

Looks like I have not allocated the memory correctly but how could I do it otherwise?

Cheers, Tom

17th May 2010, 11:31
Maybe I should add that the com object provides access to a I/0-board attached via USB. The GetDataEx() function has as parameters the (empty) array and the number of points that should be read. It then fills the array with the requested number of 16-Bit integers.

Lines 3-6 are part of a function that is called whenever there are new datapoints available, where "i" is the number of datapoints.

I have checked in the debugger that res_array is initialized correctly and increasing its size does not change the problem.