CoCreateInstance hangs - possible reasons?
Posted on 2004-04-05
Under certain circumstances, a CoCreateInstance call hangs my application. As it seems after some other parts of my program uses COM interfaces and such. I am trying to instanciate an object like this:
// initialize COM
hresult = CoInitialize(NULL);
// get component CLSID
hresult = CLSIDFromProgID(OLESTR("mydll.CMyComClass"), &clsid);
// the class we defined in dll
// create a class instance
hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
__uuidof(mydll::_CMyComClass), (LPVOID *) &t);
[ ... ]
Before other COM calls have been made, this code works perfectly. Afterwards, the CoCreateInstance() call hangs my application each and every time. It never comes back. No error message, it's just that nothing happens.
Any ideas? Urgent!