src/win32: Add support for COINIT_APARTMENTTHREADED

This commit is contained in:
Shen-Ta Hsieh 2020-12-02 07:19:36 +08:00 committed by Max Kellermann
parent 22b840c2f1
commit 0cccdcf9b2
1 changed files with 11 additions and 1 deletions

View File

@ -31,7 +31,17 @@ public:
COM() {
if (HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
FAILED(result)) {
throw FormatHResultError(result, "Unable to initialize COM");
throw FormatHResultError(
result,
"Unable to initialize COM with COINIT_MULTITHREADED");
}
}
COM(bool) {
if (HRESULT result = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
FAILED(result)) {
throw FormatHResultError(
result,
"Unable to initialize COM with COINIT_APARTMENTTHREADED");
}
}
~COM() noexcept { CoUninitialize(); }