//We have to get the GUID from hid class device
HidD_GetHidGuid(&hidGuid);
// Get informations about hid device
AllHIDDeviceInfo=SetupDiGetClassDevs(&hidGuid,NULL,NULL,
DIGCF_PRESENT|DIGCF_INTERFACEDEVICE);
//DIGCF_PRESENT=&H2
//DIGCF_INTERFACEDEVICE=&H10
HIDCounter=0;
while (TRUE)
{
// 这个API将发现的设备信息写入 deviceInfoData
// HIDCounter 允许这个API重复调用所有HID设备
// 如果API调用返回0,没有更多的HID设备发现
if (!SetupDiEnumDeviceInterfaces(AllHIDDeviceInfo,0,&hidGuid,
HIDCounter,&deviceInfoData))
{
// 没有发现与Vendor ID 和 Product ID匹配的HID设备
AfxMessageBox("I found no hid device");
SetupDiDestroyDeviceInfoList(AllHIDDeviceInfo);
return FALSE;
//break;
}
else
{
UINT uID=pWnd->GetDlgCtrlID();
switch(uID)
{
case IDC_LIST1:
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkColor(RGB(255,0,0));
break;
}
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
}