PDA

View Full Version : using axtivex controls in qt4



eli
1st August 2011, 07:28
hi all:
I get a activex controls (.OCX file) from manufacturer. following code is a prototype described in manual.


short doGetMeasureDataEx(short iDev, float* x, float* y, float* p);

the argument 0 ("iDev") is in-parameter. Arguments 1, 2 and 3("x", "y", "p") are out-parameter, two element array and pointer, so, I should get 6 float type values totally. these 6 values are stored in x[0], x[1], y[0], y[1], p[0], p[1].

I try dynamicCall to use this function as following:


QString str5 = "doGetMeasureDataEx(int, double&, double&, double&)";
QList<QVariant> vars5;
QVariant res5;
vars5 << 1 << 0.0 << 0.0 << 0.0 ;
res5 = doSpot->dynamicCall(str5.toLatin1(), vars5);


in my qt' test program, after calling "dynamicCall()" in my machine, the vars5 is: vars5[0] = 1, vars5[1] = -12.143, vars5[2] = -0.973, vars5[3] = 0.812. ie, vars5[0] = iDev, vars5[1] = x[0], vars5[2] = y[0], vars5[3] = p[0]. I can't get x[1], y[1], p[1] values.

and, I also use dumpcpp to create a "dospotpc.h" and "dospotpc.cpp" file:
"dumpcpp {74676A0F-BB65-48A0-8044-F453692E9A8A} -o dospotpc"
In file "dospotpc.h", this function prototype is:


inline int doGetMeasureDataEx(int numDev, double& Xo, double& Yo, double& Po);

I don't know why the function argument transform from pointer type to reference type. how to use this activex control correctly, and get x[1], y[1], p[1] values? please help me to solve this problem.