How to call COM from a workflow created using NT QueueUserWorkItem?

I have a set of tasks that I subordinate to an NT thread using QueueUserWorkItem. I need to make some COM calls from these separate threads to access data inside WMI. However, I am not sure how the correct calls should be made CoInitializeEx.

Basically, documents CoInitializeExsay that a call should be made once in a thread. But I do not own these threads - NT does. I do not know when they are created or destroyed, or something like that. Do I basically call ::CoInitializeEx()(c COINIT_MULTITHREADED) at the beginning of the thread routine, and then ::CoUninitialize()at the end of my threading routine?

+1
source share
1

CoInit CoUninit , . . , , CoUninit CoUninit, CoInit .

+1

All Articles