diff options
author | Shen-Ta Hsieh <ibmibmibm.tw@gmail.com> | 2020-12-02 07:19:36 +0800 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-03-04 18:37:56 +0100 |
commit | 0cccdcf9b215a41f4f600207f326e93b3c11fdfe (patch) | |
tree | d7fcb84d76670e8709d3676b3190c6d8d5191798 /src/win32 | |
parent | 22b840c2f18a225aa706b9d3fcce2f7b0f319975 (diff) |
src/win32: Add support for COINIT_APARTMENTTHREADED
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/Com.hxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/win32/Com.hxx b/src/win32/Com.hxx index 0c3c400fb..a2aa062a1 100644 --- a/src/win32/Com.hxx +++ b/src/win32/Com.hxx @@ -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(); } |