How can I communicate with a HID USB device in delphi

I have been studying this problem for a while, and I just can't figure out how to do it right. I have a version of C ++ software that I would like to make in delphi, but I cannot get it to work in delphi. I need some kind of tutorial or guide that can show me how to connect, read and write data to a USB HID device.

+5
source share
2 answers

See the USB Jan Axelson page for an example . He also wrote a book. USB Complete .

See also Robert Marquardt HID Controller Set for Delphi .

Delphi 2009 , , SO: using-hidcontroller-on-delphi-2010

+6

QueryDosDevice . , , , . ( , HID- , ). "USB" "VID" "PID" GUID.

CreateFile, "\\?\" (I THandleStream). :

var
  h:THandle;
begin
  h:=CreateFile(
    PChar('\\?\'+MyPortName),
    GENERIC_WRITE or GENERIC_READ,FILE_SHARE_WRITE or FILE_SHARE_READ,
    nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
  if h=INVALID_HANDLE_VALUE then RaiseLastOSError;
  MyPort:=THandleStream.Create(h);
  SetCommTimeouts(h,MyFCommTimeouts);
+3

All Articles