VC 判断电脑是否有视频设备!
谢谢!!!
VC 判断电脑是否有视频设备!
谢谢!!!
捕捉视频流吗?
参考资料: http://www.pudn.com/downloads174/sourcecode/graph/texture_mapping/detail810630.html
转载csdn未经测试,如有问题请留言
#include <setupapi.h> #include <devguid.h> #include <regstr.h> #pragma comment(lib,"Setupapi.lib") CListBox m_strList; ........ 枚举所有硬件设备的主要实现代码: m_strList.ResetContent(); HDEVINFO hDevInfo; SP_DEVINFO_DATA DeviceInfoData; DWORD i; // Create a HDEVINFO with all present devices. hDevInfo = SetupDiGetClassDevs(NULL, 内容来自www.stl.vc 0, // Enumerator 0, DIGCF_PRESENT | DIGCF_ALLCLASSES ); if (hDevInfo == INVALID_HANDLE_VALUE) { // Insert error handling here. return ; } // Enumerate through all devices in Set.
www.stl.vc
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i, &DeviceInfoData);i++) { DWORD DataT; LPTSTR buffer = NULL; DWORD buffersize = 0; // // Call function with null to begin with,www.stl.vc
// then use the returned buffer size // to Alloc the buffer. Keep calling until // success or an unknown failure. // while (!SetupDiGetDeviceRegistryProperty( hDevInfo, &DeviceInfoData, SPDRP_DEVICEDESC, C++编程网 &DataT, (PBYTE)buffer, buffersize, &buffersize)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { // Change the buffer size.www.stl.vc
if (buffer) LocalFree(buffer); buffer = (char*)LocalAlloc(LPTR,buffersize); } else { // Insert error handling here. break;C++编程网
} } m_strList.AddString(buffer); if (buffer) LocalFree(buffer); } if ( GetLastError()!=NO_ERROR && GetLastError()!=ERROR_NO_MORE_ITEMS ) { // Insert error handling here.内容来自www.stl.vc
return ; } // Cleanup SetupDiDestroyDeviceInfoList(hDevInfo); 测试环境: WINXP,WIN2000以上操作系统!http://www.stl.vc/htmlx/Else/Sys/2009/1018/4064.html
这是一个关于视频设备检测的代码片段
我以前用builder写过个dll现在找不到了
你先试试,不行我在给你写个DLL因为mfc我不是很熟悉