C++ – ATL COM Server – creating COM object defined in ATL Server from this server

atlccomnetvisual studio

I have created an ATL COM Server C++ project using a Visual Studio 2005 wizard. I added a new COM class using the ATL Simple Object wizard. Now when I try to create this COM class instance from my server (calling CoCreateInstance within the ATL server) I get CO_E_SERVER_EXEC_FAILURE error from CoCreateInstance. When I try to create this object from another project (another Win32 executable), the object gets created correctly. What causes this error?

Best Answer

There's an excellent blog post available here that discusses the reasons you can get this HRESULT.