CoInitializeEx Multithreaded
Posted: Fri Jun 29, 2007 12:15 pm
Hi.
I am developing a DLL to handle Optitrack camera model flex c:120.
Due to the use of other libraries, I am forced to initialize the COM objects using CoInitializeEx(NULL, COINIT_MULTITHREADED); instead of CoInitialize(NULL);
This causes a memory exception when calling the GetFrameImage function of INPCamera.
I get the same behaviour when modify the "GrayscaleSample".
I check in the specs about the threading issues, and it states that apartment threaded is needed (actually the before example worked fine when using
(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)). Is there any way I can use the COM as MULTITHREADED?
I am developing a DLL to handle Optitrack camera model flex c:120.
Due to the use of other libraries, I am forced to initialize the COM objects using CoInitializeEx(NULL, COINIT_MULTITHREADED); instead of CoInitialize(NULL);
This causes a memory exception when calling the GetFrameImage function of INPCamera.
I get the same behaviour when modify the "GrayscaleSample".
Code: Select all
......
int main()
{
//== Initialize Microsoft COM Interop ===============----
//CoInitialize(NULL);
HRESULT hResult = CoInitializeEx(NULL, COINIT_MULTITHREADED);
//HRESULT hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
......
(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)). Is there any way I can use the COM as MULTITHREADED?