-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfnames.cpp
56 lines (42 loc) · 1.18 KB
/
fnames.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright(c) 2016 Chew Esmero
* All rights reserved.
*/
#include "stdafx.h"
#include "fnames.h"
#include "..\include\libcamera.h"
#include "common.h"
#include "appcontext.h"
int DispatchFriendlyNames(wchar_t *pszParam, wchar_t *pszSubParam, PVOID pContext)
{
CContext *pCt = (CContext*)pContext;
ICameraMf *pCamMf = NULL;
HRESULT hr = E_FAIL;
int retcode = DEFAULT_ERROR;
hr = CreateCameraMfInstance(&pCamMf);
if (SUCCEEDED(hr) && pCamMf)
{
wchar_t *pszNames = NULL;
LONG cbSize = 0;
hr = pCamMf->GetFriendlyNames(&pszNames, &cbSize);
if (pszNames)
{
vector<std::wstring> names;
wstring wstrnames(pszNames);
split(wstrnames, L';', names);
if (names.size() > 0)
{
_tprintf(L"Available camera(s):\n");
for (int i = 0; i < names.size(); i++)
{
_tprintf(L"%d. %s\n", i + 1, names.at(i).c_str());
}
retcode = names.size();
}
free(pszNames);
}
pCamMf->Release();
}
*pCt->m_pCmdSupported = TRUE;
return retcode;
}