Can’t find COM object from C++, although Guid it’s registered

  activeqt, c++, com, dllimport, qt

First of all happy new year to everyone, hope you’re doing well!

I’m working on a C++ project in which I need to call a C# DLL I created following the first answer of this post. Once I have the DLL, I need to call it from Qt, so by using dumpcpp and the .tlb file generated by regasm, I managed to get the .cpp and .h files to use my classes. Just as a reference, the namespace of the classes is Wrapper, and the main class is Device with guid {DD4A4896-C105-4C60-839B-B18C99C8FE15}.

Once I have the generated files to use the DLL, if I try to create a Wrapper:: Device instance on Qt, I get the following error:

QAxBase::setControl: requested control {dd4a4896-c105-4c60-839b-b18c99c8fe15} could not be instantiated
QAxBase::qt_metacall: Object is not initialized, or initialization failed

It doesn’t give any more information, so I tried to check if the guid was stored on the system registry (I used the regasm command explained on the previously quoted post, and It said that it was successful, but you never know). Opening Registry editor and searching for the Guid revealed that it’s present at: ComputerHKEY_CLASSES_ROOTWOW6432NodeCLSID{DD4A4896-C105-4C60-839B-B18C99C8FE15}, which, as far as I know, is the right route for these guids, and it points to the right DLL.

I though It may be due to some kind ActiveQt problem, and as the previously quoted post explained how to use that DLL from VS C++, I decided to give it a try, using this as an another reference. I’ve finished with this code, which is supposed to create an instance of my Device object

#include <iostream>
#include <atlstr.h>
#import "C:UsersjavieDocumentsWrapperWrapperbinx86Releasenetstandard2.0Wrapper.tlb" named_guids raw_interfaces_only

inline void TESTHR(HRESULT x) { if FAILED(x) _com_issue_error(x); };

int main()

        Wrapper::IDevicePtr devPtr = nullptr;
    catch (const _com_error& e)
        CStringW out;
        out.Format(L"Exception occurred. HR = %lx, error = %s", e.Error(), e.ErrorMessage());
        MessageBoxW(NULL, out, L"Error", MB_OK);

    CoUninitialize();// Uninitialize COM

    std::cout << "Hello World!n";

However, this doesn’t work either, the createInstance method throws an exception of Class not registered and HR=80040154. Again, according to Registry editor, the class is registered, so I don’t understand the error. I’ve also tried with devPtr.CreateInstance("Wrapper.Device"), devPtr.CreateInstance("Wrapper::Device") or `devPtr.CreateInstance("Wrapper::CLSID_Device") as the links I posted suggest, but in those cases I get another exception with HR=800401f3 and message Invalid class string.

It doesn’t matter whether VS or Qt Creator are opened as administrator or not, I get the exact same error.
I have run out of ideas, and I really need to be able to use that DLL from Qt using the files generated by dumpcpp.

Does any one know what could be happening? It feels quite strange to me.

Source: Windows Questions C++