danielsson
asked on
CoCreateInstance hangs - possible reasons?
Hello there,
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:
HRESULT hresult;
CLSID clsid;
// initialize COM
hresult = CoInitialize(NULL);
// get component CLSID
if (SUCCEEDED(hresult))
hresult = CLSIDFromProgID(OLESTR("my dll.CMyCom Class"), &clsid);
// the class we defined in dll
mydll::_CMyComClass *t;
// create a class instance
if (SUCCEEDED(hresult))
hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
__uuidof(mydll::_CMyComCla ss), (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!
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:
HRESULT hresult;
CLSID clsid;
// initialize COM
hresult = CoInitialize(NULL);
// get component CLSID
if (SUCCEEDED(hresult))
hresult = CLSIDFromProgID(OLESTR("my
// the class we defined in dll
mydll::_CMyComClass *t;
// create a class instance
if (SUCCEEDED(hresult))
hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
__uuidof(mydll::_CMyComCla
[ ... ]
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On What OS you are running this code?
And Is this code gets executed before the entry point? I mean before main ()?
And Is this code gets executed before the entry point? I mean before main ()?
ASKER