summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-12 17:03:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-12 17:03:51 +0200
commiteda47922d9bd6d10e4e2fb3d3191edfaa126aef5 (patch)
tree86cef123f082a743275842d0c110dfa3d6115020 /opentrack-compat
parent0ed45348c428a950db589caa227efa86af499170 (diff)
few: use existing com threading init function
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);