Qt ActiveX Example
I'm trying to get a set of ActiveX classes and controls working in Qt however I'm not having much success.
Firstly, I've used dumpcpp to create the relevant .h and .cpp files from the typelib:
I've imported the resulting files into my Qt Widgets application. From this point onwards, I struggle. Having attempted to follow various tutorials on the web, I still can't successfully instantiate any of the classes or objects contained within.
Taking a working example from Delphi (urgh, I know), I can do the following successfully:
CoInitialize(nil); CoCreateInstance(CLASS_Library_, nil, CLSCTX_INPROC_SERVER, IID_ILibrary, fLibrary); // The following call works successfully fLibrary.Construct("", "");
Where CLASS_Library_ and IID_ILibrary are GUIDs, fLibrary is an interface which I'm able to successfully call methods on following the CoCreateInstance call.
In Qt, I'm not entirely sure what the equivalent to the above. My code as it exists at the moment is:
ENCX::Library *lib = new ENCX::Library(); // The following call generates these errors: // CoCreateInstance failure (CoInitialize has not been called) // QAxBase::qt_metacall: Object is not initialized, or initialization failed error lib->Construct("", "");
Please could someone offer some suggestions as to where I'm going wrong?
I appreciate that this is probably a very incorrect way to achieve what I'm wanting.