Hi, I am trying to invoke an interface from COM object installed as a component service in windows by using the following code:
#include <ActiveQt/QAxObject>
#include <ActiveQt/QAxWidget>
#include <QUuid>
#include <objbase.h>
#include <unknwn.h>
#include "ui_qt1.h"
{
public:
};
MainWindow
::MainWindow(QString & str
){
Ui::Window ui;
ui.setupUi(this);
ui.lineEdit->setText(str);
}
int main(int argc, char ** argv)
{
component1.setControl("{DEE370B4-933F-49F6-858C-26D028319C3F}");
void** interface1;
HRESULT hr;
IUnknown *iface=0;
hr=component1.queryInterface(IID_IUnknown,(void**)&iface);
if(iface)
{
iface->Release();
str="Interface supported";
}
else
{
str="NoT supported";
}
MainWindow w(str);
w.show();
return a.exec();
}
#include <ActiveQt/QAxObject>
#include <ActiveQt/QAxWidget>
#include <QUuid>
#include <objbase.h>
#include <unknwn.h>
#include "ui_qt1.h"
class MainWindow: public QMainWindow
{
public:
MainWindow(QString & str);
};
MainWindow::MainWindow(QString & str)
{
Ui::Window ui;
ui.setupUi(this);
ui.lineEdit->setText(str);
}
int main(int argc, char ** argv)
{
QApplication a(argc, argv);
QAxObject component1;
component1.setControl("{DEE370B4-933F-49F6-858C-26D028319C3F}");
void** interface1;
HRESULT hr;
IUnknown *iface=0;
hr=component1.queryInterface(IID_IUnknown,(void**)&iface);
QString str;
if(iface)
{
iface->Release();
str="Interface supported";
}
else
{
str="NoT supported";
}
MainWindow w(str);
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
And in my project I am in the end displaying the QString str. Everytime it is displaying "Not supported" which means that I am not getting even the IUnknown interface from the component, which is strange as every Component must have an IUnknown interface.
Can anyone help me getting this interface from the component?
Thanks,
Mridul
Bookmarks