Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ActiveQt dynamicCall error: Unknown error

ActiveQt dynamicCall error: Unknown error

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 3 Posters 3.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MJ_P
    wrote on last edited by MJ_P
    #1

    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?

    1 Reply Last reply
    1
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MJ_P
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MJ_P
            wrote on last edited by
            #5

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

            mrjjM 1 Reply Last reply
            1
            • M MJ_P

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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MJ_P
                wrote on last edited by
                #7

                @mrjj
                Just compiled with 5.9.6:
                Same behaviour…

                mrjjM 1 Reply Last reply
                1
                • M MJ_P

                  @mrjj
                  Just compiled with 5.9.6:
                  Same behaviour…

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MJ_P
                    wrote on last edited by
                    #9

                    @mrjj
                    Thanks!

                    mrjjM 1 Reply Last reply
                    0
                    • M MJ_P

                      @mrjj
                      Thanks!

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #10

                      @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 ?)

                      1 Reply Last reply
                      0
                      • hskoglundH Online
                        hskoglundH Online
                        hskoglund
                        wrote on last edited by
                        #11

                        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 :-)

                        1 Reply Last reply
                        1
                        • M Offline
                          M Offline
                          MJ_P
                          wrote on last edited by
                          #12

                          @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.

                          1 Reply Last reply
                          0
                          • hskoglundH Online
                            hskoglundH Online
                            hskoglund
                            wrote on last edited by
                            #13

                            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.

                            M 2 Replies Last reply
                            0
                            • hskoglundH hskoglund

                              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.

                              M Offline
                              M Offline
                              MJ_P
                              wrote on last edited by
                              #14

                              @hskoglund
                              I am going to test it on friday.

                              1 Reply Last reply
                              0
                              • hskoglundH hskoglund

                                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.

                                M Offline
                                M Offline
                                MJ_P
                                wrote on last edited by
                                #15

                                @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?

                                1 Reply Last reply
                                0
                                • hskoglundH Online
                                  hskoglundH Online
                                  hskoglund
                                  wrote on last edited by
                                  #16

                                  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);
                                  
                                  M 1 Reply Last reply
                                  1
                                  • hskoglundH hskoglund

                                    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);
                                    
                                    M Offline
                                    M Offline
                                    MJ_P
                                    wrote on last edited by
                                    #17

                                    @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))

                                    1 Reply Last reply
                                    0
                                    • hskoglundH Online
                                      hskoglundH Online
                                      hskoglund
                                      wrote on last edited by hskoglund
                                      #18

                                      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.

                                      M 1 Reply Last reply
                                      1
                                      • hskoglundH hskoglund

                                        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.

                                        M Offline
                                        M Offline
                                        MJ_P
                                        wrote on last edited by
                                        #19

                                        @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.

                                        hskoglundH 1 Reply Last reply
                                        0
                                        • M MJ_P

                                          @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.

                                          hskoglundH Online
                                          hskoglundH Online
                                          hskoglund
                                          wrote on last edited by
                                          #20

                                          @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?

                                          M 1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved