Merge pull request #440 from dkorpel/patch-2

com.d: Add option for multithreaded COM
This commit is contained in:
Adam D. Ruppe 2024-06-17 07:30:58 -04:00 committed by GitHub
commit 050d1a0728
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

5
com.d
View File

@ -196,11 +196,12 @@ shared static ~this() {
}
///
void initializeClassicCom() {
void initializeClassicCom(bool multiThreaded = false) {
if(coInitializeCalled)
return;
ComCheck(CoInitialize(null), "COM initialization failed");
ComCheck(CoInitializeEx(null, multiThreaded ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED),
"COM initialization failed");
coInitializeCalled++;
}