summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack-compat')
-rw-r--r--opentrack-compat/camera-names.cpp9
1 files changed, 4 insertions, 5 deletions
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 <windows.h>
# include <dshow.h>
+# include "win32-com.hpp"
+# include <cwchar>
#elif defined(__unix) || defined(__linux) || defined(__APPLE__)
# include <unistd.h>
#endif
@@ -32,9 +33,7 @@ OPENTRACK_COMPAT_EXPORT QList<QString> 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<QString> 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);