Threads
-
Hi, I have a SDI application in which I create 2 extra threads. Using the debugger I get the following error intermittently: Unhandled Exception at 0x77e6d756 in Application.exe: Microsoft C++ exception: _com_error @ 0x02a3f44 Then the file comip.h is opened and the following bit of code generates the afore-mentioned error: HRESULT hr = CreateInstance( str, pOuter, dwClsContext ); The value of hr is 0x800401f0 CoInitialize has not been callled. If anyone has any clue what is going on here, feel free to let me know. I thank you for any suggestions. Regards Rui
-
Hi, I have a SDI application in which I create 2 extra threads. Using the debugger I get the following error intermittently: Unhandled Exception at 0x77e6d756 in Application.exe: Microsoft C++ exception: _com_error @ 0x02a3f44 Then the file comip.h is opened and the following bit of code generates the afore-mentioned error: HRESULT hr = CreateInstance( str, pOuter, dwClsContext ); The value of hr is 0x800401f0 CoInitialize has not been callled. If anyone has any clue what is going on here, feel free to let me know. I thank you for any suggestions. Regards Rui
If you access any COM objects or make any calls to COM functions you must first call
CoInitialize()
at the beginning of each thread. Roger Stewart "I Owe, I Owe, it's off to work I go..." -
If you access any COM objects or make any calls to COM functions you must first call
CoInitialize()
at the beginning of each thread. Roger Stewart "I Owe, I Owe, it's off to work I go..."Thanks, I forgot to add that I do have queries to a dB in my threads and yes I do have CoInitialize( NULL ); at the beginning of the function called by the thread. Unless the CoInit is at the wrong place. I would also like to add that I am running my code in debug and the error does not always occur. It appears randomly and this is what is puzzling me. Thanks regards Rui