COM Object desactivated
-
wrote on 13 Apr 2022, 15:11 last edited by
-
wrote on 13 Apr 2022, 15:19 last edited by
-
wrote on 13 Apr 2022, 15:32 last edited by
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
-
wrote on 13 Apr 2022, 15:55 last edited by
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
-
wrote on 13 Apr 2022, 16:06 last edited by
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.
-
wrote on 13 Apr 2022, 16:11 last edited by
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
-
wrote on 13 Apr 2022, 16:29 last edited by
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) -
wrote on 13 Apr 2022, 16:48 last edited by
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 :-)
-
wrote on 14 Apr 2022, 07:17 last edited by
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.
-
wrote on 14 Apr 2022, 09:34 last edited by
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/10