[Solved]ActiveQt - Problem with querySubObject



  • Hi,

    I am using a OPC Automation library for accessing data from a OPC Server.

    Here is the code so far:
    @ QAxObject *server=new QAxObject("Matrikon.OPC.Automation.1");
    if(server && !server->isNull())
    {
    //Matrikon simulation opc server
    QString uuidServer="{F8582CF2-88FB-11D0-B850-00C0F0104305}";
    server->dynamicCall("Connect(QString)",uuidServer);

        qDebug()<<server->dynamicCall("VendorInfo()").toString();
    
        QAxObject *groups = server->querySubObject("OPCGroups()");
    
        if(groups && !groups->isNull())
        {
            qDebug()<<groups->dynamicCall("Count()");
            qDebug()<<groups->dynamicCall("VendorInfo()");
        }
    

    }@

    The problem is, that the groups object seems to be pointing to the server object.
    To test this I called the Count()-method of the OPCGroups class and the VendorInfo()-method of the OPCServer class on the groups object.
    Both calls to VendorInfo() succeeded, whether I called it on the server object or on the groups object.
    But calling count() on the groups object gave me the following error:
    @QAxBase::dynamicCallHelper: Count(): No such property in [unknown]
    Candidates are:
    ClientName
    CurrentTime
    control@

    I already made a test application in .Net without problems, so I think the typelibrary is working correctly.

    What could be the problem here?
    Might this be a bug in the querySubObject function?

    Thanks,
    Christian



  • I worked around this problem by using queryInterface instead of dynamicCalls.


Log in to reply
 

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