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. Connecting to OCX COM object : QAxBase::qt_metacall: Object is not initialized, or initialization failed
Forum Update on Monday, May 27th 2025

Connecting to OCX COM object : QAxBase::qt_metacall: Object is not initialized, or initialization failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 930 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.
  • S Offline
    S Offline
    SAJMED
    wrote on 13 Apr 2022, 13:47 last edited by
    #1

    Hi, I have the same problem described in this page but the answer given there doesn't solve my problem because I alredy use QApplication.

    "ocx1lib.h" is given using dumpcpp.exe as the page above.

    My code is :

    #include "mainwindow.h"
    #include "ocx1lib.h"
    #include <QApplication>
    #include <QDebug>
    #include "combaseapi.h"
    
    using namespace OCX1Lib;
    int main(int argc, char *argv[])
    {
        _DDctl * readObj = new _DDctl();
        //qDebug() << readObj->setControl("{22842328-3FCE-11D1-9B93-0020AF524FA5}");
        readObj->SetLinkTopic("ncdde|ncu840d");
    
        //QApplication a(argc, argv);
        //MainWindow w;
        //w.show();
        //return a.exec();
    
        return 0;
    }```
    K 1 Reply Last reply 13 Apr 2022, 13:51
    0
    • S SAJMED
      13 Apr 2022, 13:47

      Hi, I have the same problem described in this page but the answer given there doesn't solve my problem because I alredy use QApplication.

      "ocx1lib.h" is given using dumpcpp.exe as the page above.

      My code is :

      #include "mainwindow.h"
      #include "ocx1lib.h"
      #include <QApplication>
      #include <QDebug>
      #include "combaseapi.h"
      
      using namespace OCX1Lib;
      int main(int argc, char *argv[])
      {
          _DDctl * readObj = new _DDctl();
          //qDebug() << readObj->setControl("{22842328-3FCE-11D1-9B93-0020AF524FA5}");
          readObj->SetLinkTopic("ncdde|ncu840d");
      
          //QApplication a(argc, argv);
          //MainWindow w;
          //w.show();
          //return a.exec();
      
          return 0;
      }```
      K Offline
      K Offline
      KroMignon
      wrote on 13 Apr 2022, 13:51 last edited by
      #2

      @SAJMED Hello and welcome to Qt Forum.
      What page and problem are you talking about?

      I don't understand what you want to do and what is not working as expected.

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SAJMED
        wrote on 13 Apr 2022, 13:58 last edited by
        #3

        Sorry for the delay I can only post once every 600 second(s), I forget to add the link

        https://forum.qt.io/topic/69584/connecting-to-com-object-requested-control-could-not-be-instantiated

        and the error I'm having is this while executing the code above :
        QAxBase::qt_metacall: Object is not initialized, or initialization failed

        K 1 Reply Last reply 13 Apr 2022, 14:06
        0
        • S SAJMED
          13 Apr 2022, 13:58

          Sorry for the delay I can only post once every 600 second(s), I forget to add the link

          https://forum.qt.io/topic/69584/connecting-to-com-object-requested-control-could-not-be-instantiated

          and the error I'm having is this while executing the code above :
          QAxBase::qt_metacall: Object is not initialized, or initialization failed

          K Offline
          K Offline
          KroMignon
          wrote on 13 Apr 2022, 14:06 last edited by KroMignon
          #4

          @SAJMED said in Connecting to OCX COM object : QAxBase::qt_metacall: Object is not initialized, or initialization failed:

          and the error I'm having is this while executing the code above :
          QAxBase::qt_metacall: Object is not initialized, or initialization failed

          Initializing QApplication must be done before using any QObject based classe.
          I think your code should be:

          int main(int argc, char *argv[])
          {
              QApplication a(argc, argv);
              
              _DDctl * readObj = new _DDctl();
              readObj->SetLinkTopic("ncdde|ncu840d");
              //qDebug() << readObj->setControl("{22842328-3FCE-11D1-9B93-0020AF524FA5}");
          
              //MainWindow w;
              //w.show();
              //return a.exec();
              return 0;
          }
          

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          1
          • S Offline
            S Offline
            SAJMED
            wrote on 13 Apr 2022, 14:09 last edited by
            #5

            Thank you @KroMignon for you help, It doesn't solve the problem.

            K 1 Reply Last reply 13 Apr 2022, 14:27
            0
            • S SAJMED
              13 Apr 2022, 14:09

              Thank you @KroMignon for you help, It doesn't solve the problem.

              K Offline
              K Offline
              KroMignon
              wrote on 13 Apr 2022, 14:27 last edited by
              #6

              @SAJMED said in Connecting to OCX COM object : QAxBase::qt_metacall: Object is not initialized, or initialization failed:

              It doesn't solve the problem.

              Perhaps calling setControl() has to be done, why to do you comment it out?

              int main(int argc, char *argv[])
              {
                  QApplication a(argc, argv);
                  
                  _DDctl * readObj = new _DDctl();
                  qDebug() << readObj->setControl("{22842328-3FCE-11D1-9B93-0020AF524FA5}");
                  readObj->SetLinkTopic("ncdde|ncu840d");
              
                  //MainWindow w;
                  //w.show();
                  //return a.exec();
                  return 0;
              }
              

              I have never use ActiveQt, maybe there is another forum user which may help you.

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SAJMED
                wrote on 13 Apr 2022, 14:47 last edited by
                #7

                when I call setControl()
                I have this error :

                CoCreateInstance failure (Classe non enregistrée)
                QAxBase::setControl: requested control {22842328-3FCE-11D1-9B93-0020AF524FA5} could not be instantiated
                QAxBase::qt_metacall: Object is not initialized, or initialization failed

                1 Reply Last reply
                0
                • hskoglundH Offline
                  hskoglundH Offline
                  hskoglund
                  wrote on 13 Apr 2022, 14:55 last edited by
                  #8

                  H, perhaps you've forgotten the register the .ocx file? You do it with the regsvr32.exe command in a CMD window.

                  1 Reply Last reply
                  3

                  1/8

                  13 Apr 2022, 13:47

                  • Login

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