Qt-interest Archive, May 2007
Why does not querySubObject work for COM objects?
Message 1 in thread
Why does not querySubObject work for COM objects?
querySubObject() is a function of QAxBase, and QAxBase is inherited by
QAxObject and QAxWidget to export COM and ActiveX
The next test assume you have a registered server, if not just type:
idc c:\qt\4.3.0\examples\activeqt\hierarchy\release\hierarchyax.dll
/regserver
Case 1: The ActiveX works:
QString widget1("This is the first widget.");
QString widget2("Here comes the 2nd.");
activeX->dynamicCall("createSubWidget(QString)", widget1);
activeX->dynamicCall("createSubWidget(QString)", widget2);
QAxObject * result =
activeX->querySubObject("subWidget(QString)", widget1); // works fine!
QString text1 = result->dynamicCall("label()").toString(); // right!
result->dynamicCall("setLabel(QString)","setLabel(QString)"); //
right!
Case 2: The COM does not work:
hierarchyaxLib::IQParentWidget com(fmt->Object());
QString widget1("This is the first widget.");
QString widget2("Here comes the 2nd.");
com.dynamicCall("createSubWidget(QString)", widget1); // ok
com.dynamicCall("createSubWidget(QString)", widget2);
QAxObject * result = com.querySubObject("subWidget(QString)",
widget1); // crash ???
QString text1 = result->dynamicCall("label()").toString();
result->dynamicCall("setLabel(QString)","setLabel(QString)");
Question:
Why "activeX->querySubObject" works, but "com.querySubObject"
does not?
Thanks in advance,
Lingfa
--
[ signature omitted ]