資源簡介
一個小工具用來檢測電腦設備中攝像頭的ID,其中有生成好的exe,點擊運行即可,還有源碼

代碼片段和文件信息
#include?
#include?
#include?“windows.h“
#include?“dshow.h“
#include?
#pragma?comment(lib?“strmiids.lib“)
#pragma?comment(lib?“quartz.lib“)
using?namespace?cv;
using?namespace?std;
int?listDevices(vector&?list)?{
//COM?Library?Initialization
//comInit();
//if?(!silent)?DebugPrintOut(“\nVIDEOINPUT?SPY?MODE!\n\n“);
ICreateDevEnum?*pDevEnum?=?NULL;
IEnumMoniker?*pEnum?=?NULL;
int?deviceCounter?=?0;
CoInitialize(NULL);
HRESULT?hr?=?CoCreateInstance(CLSID_SystemDeviceEnum?NULL
CLSCTX_INPROC_SERVER?IID_ICreateDevEnum
reinterpret_cast(&pDevEnum));
if?(SUCCEEDED(hr))
{
//?Create?an?enumerator?for?the?video?capture?category.
hr?=?pDevEnum->CreateClassEnumerator(
CLSID_VideoInputDeviceCategory
&pEnum?0);
if?(hr?==?S_OK)?{
printf(“SETUP:?Looking?For?Capture?Devices\n“);
IMoniker?*pMoniker?=?NULL;
while?(pEnum->Next(1?&pMoniker?NULL)?==?S_OK)?{
IPropertyBag?*pPropBag;
hr?=?pMoniker->BindToStorage(0?0?IID_IPropertyBag
(void**)(&pPropBag));
if?(FAILED(hr))?{
pMoniker->Release();
continue;??//?Skip?this?one?maybe?the?next?one?will?work.
}
//?Find?the?description?or?friendly?name.
VARIANT?varName;
VariantInit(&varName);
hr?=?pPropBag->Read(L“Description“?&varName?0);
if?(FAILED(hr))?hr?=?pPropBag->Read(L“FriendlyName“?&varName?0);
if?(SUCCEEDED(hr))
{
hr?=?pPropBag->Read(L“FriendlyName“?&varName?0);
int?count?=?0;
char?tmp[255]?=?{?0?};
//int?maxLen?=?sizeof(deviceNames[0])?/?sizeof(deviceNames[0][0])?-?2;
while?(varName.bstrVal[count]?!=?0x00?&&?count?255)
{
tmp[count]?=?(char)varName.bstrVal[count];
count++;
}
list.push_back(tmp);
//deviceNames[deviceCounter][count]?=?0;
//if?(!silent)?DebugPrintOut(“SETUP:?%i)?%s\n“?deviceCounter?deviceNames[deviceCounter]);
}
pPropBag->Release();
pPropBag?=?NULL;
pMoniker->Release();
pMoniker?=?NULL;
deviceCounter++;
}
pDevEnum->Release();
pDevEnum?=?NULL;
pEnum->Release();
pEnum?=?NULL;
}
//if?(!silent)?DebugPrintOut(“SETUP:?%i?Device(s)?found\n\n“?deviceCounter);
}
//comUnInit();
return?deviceCounter;
}
int?main()
{
vector?list;
listDevices(list);
cout?<“dev_size?=??????“?< for?(int?i?=?0;?i {
cout?<“device?lists:??“?< }
getchar();
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???32775680??2019-02-15?11:02??發現攝像頭設備ID\FindVideoDevice.exe
?????文件???????2648??2019-02-15?11:23??發現攝像頭設備ID\mainTest.cpp
?????文件????????119??2019-02-15?11:22??發現攝像頭設備ID\說明.txt
?????目錄??????????0??2019-02-15?11:23??發現攝像頭設備ID
-----------?---------??----------?-----??----
?????????????32778447????????????????????4
- 上一篇:Dijkstra算法最短路的可視化實現
- 下一篇:FX2N-1PG(中文).pdf
評論
共有 條評論