PDA

View Full Version : Dumpcpp generates double when activex component wants float



epsilon
29th March 2010, 03:46
Hi,
I am trying to use an activex component from a third party vendor in my Qt v4.6 application. I have had success using the OCX via dynamicCall. The vendor has supplied me with a .tlb file and I'm trying to call the methods via the C++ namespace (using Dumpcpp).

So I have in my project file
TYPELIBS = MG17Motor.tlb
HEADERS += mg17motor.h

Most things work except when I call a methods that contains [out] double parameters. The documentation for the activeX interface specifies float parameters, the generated mg17motor class uses double everywhere there should be a float, so calling the following method:
double position = 0;
mg17motor->GetPosition(0, position);
spits out the runtime error message:
QAxBase: Error calling IDispatch member GetPosition: Type mismatch in parameter 1

The method is actually an automatically generated inline function (by Dumpcpp I presume):
inline int MG17Motor::GetPosition(int lChanID, double& pfPosition)
{
int qax_result;
void *_a[] = {(void*)&qax_result, (void*)&lChanID, (void*)&pfPosition};
qt_metacall(QMetaObject::InvokeMetaMethod, 77, _a);
return qax_result;
}

when I generate a .tlh file from the OCX itself (using the MIDL compiler) I get the following for that function definition:
long GetPosition (long lChanID, float * pfPosition );

Am I doing something wrong?
Or is Qt enable to invoke IDispatch methods with [out] float parameters thru the namespace method?