Nominate our 2022 Qt Champions!

Is that possible to get an array of com+ objects from QAxObject?

  • Example of what I do on "ISldWorks":

    @ QAxObject *sw = new QAxObject("SldWorks.Application", this);

    int i2 = sw->dynamicCall("GetDocumentCount()").toInt(); //return 3
    QVariant c = sw->dynamicCall("GetDocuments()");
    //debug mode and typeName() confirm that c is QVariantList with 0 items
    QVariantList cList = c.toList();
    sw->dynamicCall("SendMsgToUser(QString)", QString::number(cList.count()) + " - " + QString::number(i2));@

    it shows 0 - 3, 0 objects in cList, and 3 really should be.

    PS When I tryed this algorithm in C#.Net it worked (3 - 3):
    @ int count = (int)sw.GetType().InvokeMember("GetDocumentCount", BindingFlags.InvokeMethod, null, sw, null);
    object[] models = (object[])sw.GetType().InvokeMember("GetDocuments", BindingFlags.InvokeMethod, null, sw, null);

            //models are operable (I tryed)
            System.Windows.Forms.MessageBox.Show(models.Count().ToString() + " - " + count.ToString());@

  • post it here "QAxBase have no implements to query array of sub objects":

  • Moderators

    I am not sure that your situation is a bug at the moment, since it seems that the object needs to be casted in order to get an array of them. If you use dumpdoc on the control then can you paste in the relevant part of documentaton that shows what it says for the GetDocuments() function? Thanks.

Log in to reply