Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

ActiveQt dynamicCall error: Unknown error



  • Since using Qt5.x I get following error message :
    QAxBase: Error calling IDispatch member GetDrawingArea: Unknown error

    on my function:

    QList<QVariant> e3Sheet::getDrawingArea()
    {
    QList<QVariant> parameters;
    parameters << QVariant();
    parameters << QVariant();
    parameters << QVariant();
    parameters << QVariant();
    dynamicCall("GetDrawingArea(QVariant&,QVariant&,QVariant&,QVariant&)",parameters);
    return parameters;
    }

    All returned parameters (QVariant) are invalid now.

    The code worked perfect on Qt4.x

    I have already replaced LIBS += -lqaxcontainer by QT+= axcontainer at my Projectfile.

    I am currently using MinGW 5.3.0 and Qt5.11.2

    Any ideas what is the fault?


  • Lifetime Qt Champion

    Hi and welcome to the forums.
    Does Qt4.x code work on SAME pc ?
    I wonder if the actual ActiveX object might have changed ?



  • Hi, thanks.
    Yes, the previous compiled binary works.
    I have to add some new features and so I tried to upgrade to Qt5.x.
    I have got a similar function with less Parameters at the same code which works...


  • Lifetime Qt Champion

    Hi
    Ok, so the ActiveX object should be the same.
    I wonder if related to
    https://bugreports.qt.io/browse/QTBUG-13845
    but it works for 4.8 so cant be.



  • The posted dynamicCall works currently at Qt4.7.4
    I think it is not the same bug...


  • Lifetime Qt Champion

    @MJ_P
    I agree.
    However, I could not find any other bug about this.
    It could be regression.
    Could you try with 5.9 ?



  • @mrjj
    Just compiled with 5.9.6:
    Same behaviour…


  • Lifetime Qt Champion

    @MJ_P
    Ok, its either something changed using QVariant
    or simply a bug. (regression from 4.8 to 5.XX)
    Give it a day or two. if nobody else have more information
    i would open a bug report.



  • @mrjj
    Thanks!


  • Lifetime Qt Champion

    @MJ_P
    Oh, i realized the wording was funny.
    -> Give it a day or two. if nobody else have more information
    you should open a bug report.

    If you can provide a minimal example to reproduce this,
    it really helps. Also info about what ActiveX object you are using. ( libra office perhaps ?)



  • Hi, the ActiveX support in Qt is ancient and should be the same for Qt4 and Qt5, so you should be getting your 4 floats (xmin, ymin, xmax, ymax) in Qt5 also.
    Googled and found this so if the app object (the one you create with something like new QAxObject("CT.Application");) has a visible property, try setting it to true. Note: this is just a guess :-)



  • @hskoglund
    Hi, you are right. I am using here an app object of E³ ( new QAxObject("Ct.Sheet")).
    I guess the problem is not the ActiveX itself. The Language of the App is german.
    Since Qt5 every string conversion is done by the 'C' locale now.
    At Qt4 the current locale was used for conversions. (toDouble() and so on)
    Perhaps the floats of xmin, ymin, xmax and ymax are formated as
    0,0, 0,0, 420,0 270,0 by E³ and so an internal conversion fails now.
    It is just a guess, but it is the only huge diff I found…

    Other dynamicCalls to E³ which return int or Strings work fine.



  • Hmm, you could try changing to US locale, for example by creating a new user on your PC, set that user's locale/language to US and try the call again for that user.



  • @hskoglund
    I am going to test it on friday.



  • @hskoglund
    Ok, I have tested on US-Windows and US Installation of E³.
    The Bug still exists. It is not a language issue.

    Any other idea what I can try?



  • Hi, just guessing but have you tried initializing the QVariants to 0.0, like this:

    QList<QVariant> parameters;
    parameters << QVariant(0.0);
    parameters << QVariant(0.0);
    parameters << QVariant(0.0);
    parameters << QVariant(0.0);
    dynamicCall("GetDrawingArea(QVariant&,QVariant&,QVariant&,QVariant&)",parameters);
    


  • @hskoglund
    Hi, also the same error…
    QAxBase: Error calling IDispatch member GetDrawingArea: Unknown error

    qDebug on parameters after calling the function:
    (QVariant(double, 0), QVariant(double, 0), QVariant(double, 0), QVariant(double, 0))



  • Hmm, seems like E³ indeed is not happy talking to Qt5 using QAxObject, there are some alternatives:

    1. if there's a .tlb file (type library file) available for E³ then you can try using Qt's dumpcpp tool on it. Dumpcpp.exe will create C++ wrapper classes than can be included in your program instead of going through QAxObject.

    2. you can go native and use Microsoft's old ATL library to invoke E³'s COM methods directly, it's called classic COM (I spent most of the 90's and the years around the turn of the century doing exactly that :-))

    Edit: forgot to say, if you have lots of calls through QAxObject that do work, then alternative 1) might not be a good idea because you have to refactor all the calls.
    But with alternative 2) you can opt to use ATL/Classic COM just for that single GetDrawingArea() function, i.e. you can still use QAxObject and obtain a COM pointer through it for use in Classic COM.



  • @hskoglund
    Using e3.tlb doesn't work on GetDrawingArea function.
    It seems to be the same problem. The parameters are also invalid.
    The C++ wrapper works on Qt4 but not on Qt5.



  • @MJ_P
    I see, I'm guessing something in E³ 's implementation of COM is not 100% kosher, perhaps Qt4 was more generous in this regard.
    So alternative 2), a plunge into Classic Com seems to be only option then.
    It's not that bad :-)

    Maybe I can help, is there a demo version of something of E³ that I can download and test with?



  • @hskoglund
    I guess there is no demo version of E³ available.
    The only option is to contact Zuken (manufacturer) and
    ask for a limited testing license.
    The last demo version without license was E³-2009.


Log in to reply