|
发表于 2020-8-9 16:00:03
|
显示全部楼层
给你几个函数,应该够你用了,别嫌弃
DeviceHandle=CreateFile (detailData->DevicePath,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
HidD_GetPreparsedData (DeviceHandle, &PreparsedData);
HidP_GetCaps (PreparsedData, &Capabilities);
ReadHandle=CreateFile
(detailData->DevicePath,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
Result = ReadFile
(ReadHandle,
InputReport,
Capabilities.InputReportByteLength,
&NumberOfBytesRead,
(LPOVERLAPPED) &HIDOverlapped);
Result = WriteFile
(DeviceHandle,
OutputReport,
Capabilities.OutputReportByteLength,
&BytesWritten,
NULL);
FILE_FLAG_OVERLAPPED,
NULL);
CloseHandle(DeviceHandle);
CloseHandle(ReadHandle);
|
|