PDA

View Full Version : QAxWidget->dynamiccall



codeman
14th September 2012, 15:17
Hello friends,

when I call the code below I get this error:
QAxBase: Error calling IDispatch member SetSession: Type mismatch in parameter 0
QAxBase: Error calling IDispatch member SetObject: Type mismatch in parameter 0

I assume that I have to convert my types into a variant before give it to the dynamiccall method.



try
{
int ISessionPtrId = QMetaType::type("ISessionPtr");
QVariant vSession(ISessionPtrId, &spSession);
m_Control->dynamicCall("SetSession(ISessionPtr)", vSession);
int IObjectPtrId = QMetaType::type("IObjectPtr");
QVariant vObject(IWMObjectPtrId, &spObject);
m_Control->dynamicCall("SetObject(IObjectPtr)", vObject);
}
catch(const std::exception &e)
{
qDebug() << e.what();
}
catch(...)
{
qDebug() << "m_Control->dynamicCall error";
}



Could anybody help me to find out the right way?

Yours,