SharePointCommunity
Die deutschsprachige Community für SharePoint, Microsoft 365, Teams, Yammer und mit Azure

Sponsored by

Willkommen im Forum Archiv.
Einträge sind hier nicht mehr möglich, aber der Bestand von 12 Jahren SharePoint-Wissen ist hier recherchierbar.




COM Use in Multithreaded Program

Unbeantwortet Dieser Beitrag hat 0 Antworten

Ohne Rang
13 Beiträge
Faelanstevie erstellt 16 März 2018 11:32
SchlechtSchlechtIn OrdnungIn OrdnungDurchschnittDurchschnittGutGutSehr gutSehr gut

Hi,

 

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: -

http://bit.ly/2FWWbJ8

Motion graphics service

 

Thanks!