CoCreateInstance 0x80040154 Class not registered error

-1

COM newbie here and appreciate any help/explanation. I have installed 32 bit COM type library on Windows 10 OS 64 bit.. When I am trying to access COM component on one of my test 32 bit dll everything works perfectly fine (VS2017).

#import "..\SDK_Location\SDKCOMLib.dll"

bool Connect()
{

HRESULT hr;

::CoInitialize(NULL);

COMLib::IConnectionPtr connection = NULL;
if (FAILED(hr = ::CoCreateInstance(__uuidof(COMLib::Connection), NULL, CLSCTX_ALL,
        __uuidof(COMLib::IConnection), (void**)&connection))) 
// or  connection.CreateInstance(__uuidof(COMLib::Connection))))
{
    std::cout << "Failed for \"Connection.CreateInstance\"! Error code: \"0x" << std::hex << hr << std::endl;
    ::CoUninitialize();
    return false;
}

connection->Connect(data);

The same code used on our 32 bit project fails with 0x80040154 Class not registered error (same machine/ same project properties/ VS2017).

  • C++ source code in both projects is importing Win32 type library from the same location
  • TypeLibrary registred and available on OleView.
  • Checked all the registry entries, and they reference the correct files, locations, interface entries, coclass entries etc.
  • Cleaned the registry entries, reinstalled DLL
  • Confirmed that __uuidof() is passing correct coclass GUID
  • Both projects have got same project properties
  • Other COM components from different type libraries work fine.

Any idea what can block access to that COM component on main project?

Thanks in advance

c++
visual-studio-2017
com
asked on Stack Overflow Apr 8, 2020 by Snejk

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0