ActiveQt dynamic call with a VARIANT* data type
-
I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type
here is the header for the ActiveX function
HRESULT ScanUSB([out] VARIANT* serialNumbers);
here is the documentation generated for the activeX function using the generateDocumentation function
void ScanUSB (QVariant& serialNumbers)
[slot]method ScanUSB
Connect a signal to this slot:
QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));
Or call the function directly:
QVariantList params = ... object->dynamicCall("ScanUSB(QVariant&)", params);
and here is my code
QVariant serials; QList<QVariant> param; param<<serials; cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt();
the function returns with out errors, i just don't get any data back
-
you try to call a method which gets a QVariant and put in a QList of QVariant. This mit be the problem. Wrap everything in a QVariant.
-
@adam3914 said in ActiveQt dynamic call with a VARIANT* data type:
I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type
here is the header for the ActiveX function
@HRESULT ScanUSB([out] VARIANT* serialNumbers);
@here is the documentation generated for the activeX function using the generateDocumentation function
@void ScanUSB (QVariant& serialNumbers) [slot]method ScanUSB
Connect a signal to this slot:
QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));
Or call the function directly:
QVariantList params = ...
object->dynamicCall("ScanUSB(QVariant&)", params);@and here is my code
@QVariant serials;
QList<QVariant> param;
param<<serials;
cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt()<<endl;@the function returns with out errors, i just don't get any data back
did you solve the problem?
-
Hi yougangZong ,
Do you have exactly the same ActiveX component?
What is missing in this code :
QVariant serials;//<---------------- QList<QVariant> param; param<<serials; cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt()<<endl;
serials is not defined yet. So filling param with nothing.
You can also use something like:QList<QVariant> param = {123};
Eddy