QT 5.5.1 ActiveX dynamicCall can not return correctly!



  • look this codes:

    QAxObject* doc ;
    QAxObject* my_docs ;
    QAxObject* my_app = new QAxObject;

    my_app->setControl("Word.Application");

    my_docs =my_app->querySubObject("Documents");

    doc = my_docs->querySubObject("Open(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)",
    filename);

    int ret = wordapp->dynamicCall("GetDocumentCount()").toInt(); //I thisk the correct return result is 1 ,but is 0;

    please tell me why is not return 1 or why it is wrony??


  • Qt Champions 2016

    it return a Variant
    docs says
    "
    if the method does not return a value or when the function call failed this function returns an invalid QVariant object."

    so did you check with QVariant isValid() that the call does even have success ?



  • @mrjj
    thank you very much!
    the function name is not correctly which I passed, and the right function name is just like "DocumentCount",it is no Get before. <_>


  • Qt Champions 2016

    and no () also I guess ?
    Good found :)



  • @mrjj
    yes, your guess are right, propertys get or set interface are no ()!

    maybe this has some connection with the name of windows COM components propertys that called by QT dynamicCall("") .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.