PDA

View Full Version : Pointer to ActiveX object in QT



json84
15th June 2007, 09:50
How can I get a pointer to an ActiveX object encapsulated by a QAxWidget?
I've searched through alot of documentation and I haven't found anything that works.
The control is created through QAxWidget.setControl and an ID string. Maybe you can create the object right away somehow and pass a pointer to it to the setControl function? I have no idea, I'm quite new to COM programming...

I'm looking for something like this MFC code:

SomeInterface* axObject = GetDlgItem(IDC_NAME)->GetControlUnknown();

Thank you.

gri
15th June 2007, 13:42
Same like everywhere: queryInterface()

Copied from Qt Docs:

IUnknown *iface = 0;
activeX->queryInterface(IID_IUnknown, (void**)&iface);
if (iface) {
// use the interface
iface->Release();
}