Die deutschsprachige Community für SharePoint, Office 365 und mit Azure

COM Use in Multithreaded Program

bewertet von 0 Usern
Nicht beantwortet Dieser Beitrag hat 0 Geprüfte Antworten | 0 Antworten | 1 Follower

Ohne Rang
13 Beiträge
Faelanstevie erstellt in 16 Mrz 2018 11:32



I am using COM in my C++ Qt GUI Windows program.  It is a data backup program.  I have a worker thread to do file copy operations and a main GUI thread for the rest.  I use Volume Shadow Copy Service and IFileOperation in the worker thread, Volume Shadow Copy Service for making volume shadow copy service snapshots to copy data from, and IFileOperation for sending files to the recycle bin.  I use the Task Scheduler API and IShellLink interface in the main GUI thread to have the program start at user logon and create shortcuts to the program executable respectively.  Currently I just call CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); when needed before using COM objects in their respective thread.  The objects stay in the thread they were created in.  When done I call CoUninitialize();.  Is this proper COM threading usage?  Should I be using CoInitializeEx(NULL, COINIT_MULTITHREADED);?  Do I risk any race conditions or am I doing things properly?  Do I need to pump a message loop?  Anything else to know?


Please help.


I did not find the right solution from the internet.


References: -

Motion graphics service




Seite 1 von 1 (1 Elemente) | RSS