From eda47922d9bd6d10e4e2fb3d3191edfaa126aef5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Aug 2016 17:03:51 +0200 Subject: few: use existing com threading init function --- opentrack-compat/camera-names.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'opentrack-compat') diff --git a/opentrack-compat/camera-names.cpp b/opentrack-compat/camera-names.cpp index f17a259a..21ff3b52 100644 --- a/opentrack-compat/camera-names.cpp +++ b/opentrack-compat/camera-names.cpp @@ -2,8 +2,9 @@ #ifdef _WIN32 # define NO_DSHOW_STRSAFE -# include # include +# include "win32-com.hpp" +# include #elif defined(__unix) || defined(__linux) || defined(__APPLE__) # include #endif @@ -32,9 +33,7 @@ OPENTRACK_COMPAT_EXPORT QList get_camera_names() #if defined(_WIN32) // Create the System Device Enumerator. HRESULT hr; - hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - if (FAILED(hr)) - qDebug() << "failed CoInitializeEx" << hr << GetLastError(); + init_com_threading(com_apartment); ICreateDevEnum *pSysDevEnum = NULL; hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); if (FAILED(hr)) @@ -61,7 +60,7 @@ OPENTRACK_COMPAT_EXPORT QList get_camera_names() if (SUCCEEDED(hr)) { // Display the name in your UI somehow. - QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); + QString str((QChar*)varName.bstrVal, int(std::wcslen(varName.bstrVal))); ret.append(str); } VariantClear(&varName); -- cgit v1.2.3