ActiveQt translates my QVariantList to SAFEARRAY incorreclt?



  • Hi,

    I am trying to use ActiveQt to access a COM object and wait for its events. My first function call would be the Open to the object, but it fails.

    The signature of the function is (copied from the Doc of the COM object):
    @HRESULT STDMETHODCALLTYPE Open(
    /* [in] / LONG reserved,
    /
    [in] / SAFEARRAY * sfTypes,
    /
    [in] / SHORT lengthOfTypes,
    /
    [out] */ LONG *status);@

    ActiveQt translates this to the slot function:
    @void Open(int appHandle, QVariantList sfTypes, int lengthOfTypes, int& status);@

    But when I call the slot the following error is printed:
    @QAxBase: Error calling IDispatch member Open: Type mismatch in parameter 1@

    Parameter 1 is clearly the SAFEARRAY (QVariantList). I can call other functions (which do not have SAFEARRAY, but SHORT, LONG and BSTR) without any problem.

    My calling code is:
    @ QVariantList aiScannerTypes;
    aiScannerTypes.append(6);

    QMetaObject::invokeMethod(poActiveQtObj, "Open", Q_ARG(int, 0), Q_ARG(QVariantList, aiScannerTypes), Q_ARG(int, 1), Q_ARG(int&, iTemp));

    oResult = poActiveQtObj->dynamicCall("Open(int, QVariantList, int, int&)", QVariantList() << 0 << aiScannerTypes << 1 << iTemp);
    @

    What am I missing? Why does ActiveQt "translate" the QVariantList incorrectly?

    By the way the COM object is the Motorola CoreScanner COM object, if it says anything to anyone.

    Thank you,

    Balint Toth



  • Hi,
    did you solve your issue ? I'am very interesting because I face the exactly the same problem...

    Thank you for your help.


Log in to reply
 

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