I am programming on a hid printer now, after "CreateFile", and
according to Attributes.VendorID and Attributes.ProductID, I am sure I
got correct Handle.
then I used "WriteFile" to send message to the printer, it was always
False returned, and when I used "ReadFile", the program would hang
there. so I checked "OutputReportByteLength", it was zero, and
"InputReportByteLength" and "FeatureReportByteLength" were non-zero.
then I think maybe the printer do not suport "WriteFile", then I used
HidD_SetFeature and HidD_GetFeature to communicate with the printer.
the problem is, HidD_SetFeature always return TRUE but nothing happen
with the printer and HidD_GetFeature always return FALSE with
GetLastError 23.
BYTE * sendBuffer = new BYTE[2];
sendBuffer[0] = 0x02;
sendBuffer[1] = 0;
HidD_SetFeature(hDeviceHandle, sendBuffer, 2);
BYTE * receiveBuffer = new BYTE[FeatureReportByteLength];
receiveBuffer[0] = 0x0A;
HidD_SetFeature(hDeviceHandle, receiveBuffer,
FeatureReportByteLength);
anyone knows why I cannot communicate with it?
Thanks in advance!