(ActiveQt) Invoking interface from COM object
Hi, I am trying to invoke an interface from COM object installed as a component service in windows by using the following code:
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();
}
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
Re: (ActiveQt) Invoking interface from COM object
Guys, please me with this. Thanks!
Re: (ActiveQt) Invoking interface from COM object
Hi
I had a similar problem. Try using the name of the control in setControl () instead of classID.
John
Re: (ActiveQt) Invoking interface from COM object
mridulgandhi: where is defined HRESULT ? I think you need to link an windows header file...try it...