QAxObject->dynamicCall() throws Type Mismatch (Solved)
clinisbut last edited by
Here is my example code (very simple)
@activex = new QAxObject("832C30D8-7062-44AC-878E-0C7C64B245A8");
activex->setProperty("Settings", QString("9600,n,8,1") );@
Throws this (Description in spanish):
@QAxBase: Error calling IDispatch member Settings: Exception thrown by server
Code : 13
Source : Comm32
Description: No coinciden los tipos (type mismatch)
Connect to the exception(int,QString,QString,QString) signal to catch this exception@
Using QAxBase::generateDocumentation() clearly says that :
For more information, see help context 23 in C:\WINDOWS\system32\Comm32.chm. Read this property's value using QObject::property:
QString val = object->property("Settings").toString();
Set this property' value using QObject::setProperty:
QString newValue = ...
Or using the SetSettings slot.@
.. which is exactly what I'm trying to do.
Calling dynamicCall( "SetSettings(QString)", QString("9600,n,8,1") ); doesn't help too...
I must add that using another control like MSComm32 I have no problems (related with Qt, MSComm32 has other more serious problems)
If it helps, debugging into code I found that the exception is thrown when Qt tries to call Invoke() method of the IDispath class, inside
At line 3553, file qaxbase.cpp.
Ok I solved it.
It happens that the COM control I was trying to use is visual, and I should use QAxWidget instead of QAxObject. So replacing QAxObject by QAxWidget in the code above makes everything work.
Thank you anyway.