Connecting to COM object: requested control could not be instantiated
Solved
General and Desktop
-
Hello!
Please, help me with connecting QT programm to COM object.
COM object:
I have registered .dll - Sh4Ole.dll using
regsrv32 Sh4Ole.dll
Info from registry:
GUID = {AF5496E4-4D18-4932-A422-4C778BF11053} typelib = {95456CCB-659C-438A-8B48-C1637422941F} Name = Sh4Ole.SH4App
My code:
#include <QtCore/QCoreApplication> #include <ActiveQt\QAxBase.h> #include <ActiveQt\QAxObject.h> #include <ActiveQt\QAxBase.h> #include <QDebug> #include "SH.h" //#import "D:\\Sh4Ole.dll" using namespace Sh4Ole; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); ISH4Ole* ole = new ISH4Ole(); qDebug() << ole->setControl("{AF5496E4-4D18-4932-A422-4C778BF11053}"); qDebug() << ole->SetServerName("SDBSERV:pTa3t1000"); qDebug() << ole->DBLoginEx("Admin", ""); qDebug() << ole->DBConnected(); qDebug() << ole->GetDBVersion(); system("pause"); ole->DBLogout(); if (ole != Q_NULLPTR) ole->deleteLater(); return a.exec(); }
"SH.h" and "SH.cpp" was generated by "dumpcpp.exe"
Console output:
QAxBase::setControl: requested control {AF5496E4-4D18-4932-A422-4C778BF11053} co uld not be instantiated false QAxBase::qt_metacall: Object is not initialized, or initialization failed 6317352 QAxBase::qt_metacall: Object is not initialized, or initialization failed 6317352 QAxBase::qt_metacall: Object is not initialized, or initialization failed 6317352 QAxBase::qt_metacall: Object is not initialized, or initialization failed "" Для продолжения нажмите любую клавишу . . . QAxBase::qt_metacall: Object is not initialized, or initialization failed
Test utility from developers of SH4 works well, but it used Borland Delphi laguage.
==================================================================
-
All works well now.
Thank you!