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. COM Object desactivated
QtWS25 Last Chance

COM Object desactivated

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 551 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 last edited by
    #1

    ![alt text](desactivated.PNG image url)

    Can Some body please explain to me why I can't have access to this Com object that I register zith regsvr32.

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

      Hi, if you place the mouse cursor over the dimmed out "Dctl Control", i,e, here:
      Screenshot 2022-04-13 at 17.15.58.png

      Qt Creator should display a grey box...

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

        Re. why it's dimmed, perhaps you're running on a 64-bit Windows version?
        If yes, then you have to do a regsvr32.exe twice, one for 32-bit registration and one for 64-bit registration, like this:

        C:\Windows\SysWOW64\regsvr32.exe dctl.ocx
        C:\Windows\System32\regsvr32.exe dctl.ocx
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          SAJMED
          wrote on last edited by
          #4

          Thanks @hskoglund for the answer, I'am using 64-bit windows version And I registred the dctl.ocx as you showed me but it doesn't work

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

            Perhaps you are using a 64-bit compiler for your Qt app? When dealing wuth these 15 to 20 years old OCX-files, your best bet is to use Qt 5 (not Qt6) and a 32-bit compiler like MSVC2019.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SAJMED
              wrote on last edited by
              #6

              I'am using Qt 5.12 MinGw 64-bit, And I need to use it because I have other dlls that are only compatible with this version

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

                5.12 MinGW is ok but I think for displaying OCX controls you have to use the 32-bit version of 5.12 MinGW :-(
                (A common solution is to split your app into two apps, one for the 64-bit stuff and for the 32-bit OCX)

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

                  Hi again, googled a bit and verified that 32-bit OCX controls cannot be displayed/used from a 64-bit .exe file. So you have to split up you app somehow.

                  One way could be to keep as much as possible in your 64-bit app, and then build a 32-bit .exe Qt out-of-process ActiveX server (which just has a QMainWindow for showing the .OCX control.) For creating the ActiveX server you can use QAXContainer

                  Your ActiveX server would still have ti 32-bit to be able to host the dctl.ocx control, but because it's a standalone .exe server, you can communicate with it through QAxObject from your 64-bit main app :-)

                  1 Reply Last reply
                  3
                  • S Offline
                    S Offline
                    SAJMED
                    wrote on last edited by
                    #9

                    Hi @hskoglund ! Thank you for helping me, I tried to use the 32-bit version of 5.12 MinGW to test but I'm still getting the ocx desactivated.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SAJMED
                      wrote on last edited by
                      #10

                      I tries again using the 32-bits version and I converted the OCX into .cpp and .h so as to integrated to Qt. And now it works :

                      #include "mainwindow.h"
                      #include <QApplication>
                      #include "ocx1lib.h"
                      #include <QDebug>
                      #include "combaseapi.h"
                      
                      using namespace OCX1Lib;
                      
                      int main(int argc, char *argv[])
                      {
                          QApplication a(argc, argv);
                      
                          Dctl readObj;
                          readObj.SetEnabled(false);
                          readObj.SetLinkTopic("ncdde|ncu840d");
                          qDebug() << "LinkTopic : " << readObj.LinkTopic();
                          readObj.SetLinkItem("/Channel/Parameter/R[15]");
                          qDebug() << "LinkItem : " << readObj.LinkItem();
                      
                          readObj.SetData("7");
                          readObj.SetEnabled(true);
                          readObj.SetLinkCmd(CmdPoke);
                         
                          //MainWindow w;
                          //w.show();
                          //return a.exec();
                      
                          return 0;
                      }
                      1 Reply Last reply
                      0

                      • Login

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