通过任务管理器禁用鼠标

2019-04-14 19:00发布

class="markdown_views prism-atom-one-light"> //枚举设备,储存起来 BOOL CMFCtestDlg::GetDeviceList(LPGUID lpGuid) { BOOL bFlag = TRUE; do { HDEVINFO hDevInfo; SP_DEVINFO_DATA DeviceInfoData; DWORD i; // 得到设备 HDEVINFO ,若是加上了| DIGCF_ALLCLASSES 则表示查询出所有设备的信息,lpGuid这个参数无效。 hDevInfo = SetupDiGetClassDevs(lpGuid, 0, 0, DIGCF_PRESENT /*| DIGCF_ALLCLASSES*/ ); if (hDevInfo == INVALID_HANDLE_VALUE) { printf ("SetUpDi ERR!"); bFlag = FALSE; break; } cout<<"hDevInfo:"< 其中在OnInitDialog函数中: LPGUID Class = (LPGUID)malloc(sizeof(LPGUID)); //class是USB输入设备的的类GUID Class->Data1=0x745a17a0; Class->Data2=0x74d3; Class->Data3=0x11d0; Class->Data4[0]=0xb6; Class->Data4[1]=0xfe; Class->Data4[2]=0x00; Class->Data4[3]=0xa0; Class->Data4[4]=0xc9; Class->Data4[5]=0x0f; Class->Data4[6]=0x57; Class->Data4[7]=0xda; LPGUID lpGuid=NULL; GetDeviceList(Class); SetDeviceStatus(theItem,0); 其中,重要的变量定义如:
DeviceInfo theItem; #define CLOSESTATE DICS_DISABLE #define OPENSTATE DICS_ENABLE #define STATE OPENSTATE
特别说明vs要以管理员身份运行。