10-31-2005 03:48 AM - edited 10-31-2005 03:48 AM
Message Edited by MaWie on 10-31-2005 03:50 AM
Message Edited by MaWie on 10-31-2005 03:52 AM
11-01-2005 07:12 AM
Mathias,
I think you should be able to call CA_InitActiveXThreadStyleForCurrentThread and set the thread style to STA in your thread function and it should work. If you do not set the thread style, then it will default to MTA. You need to make sure that your application is not using the default thread pool for anything else that would cause the threads in that pool to be MTA.
If you can't get the default thread pool to work for some reason, you could create your own thread pool. You call CmtNewThreadPool to create the new thread pool and you call CmtInstallThreadPoolCallback with EVENT_TP_THREAD_BEGIN to setup a thread pool callback that will be called by each newly created thread in that thread pool. You could use this callback to initialize each new thread in the thread pool to STA.
Hope this helps.
-Jeff
11-02-2005 04:04 AM