Author Topic: How to get notified of Input Reports without Delay  (Read 5758 times)

Thanawat

  • Member
  • ***
  • Posts: 1
How to get notified of Input Reports without Delay
« on: July 08, 2013, 03:29:29 am »
Hi,

I'm writing the Host application that will talk to a custom HID Keyboard. Though, this keyboard identifies itself to Windows as an HID, not Keyboard (so I think we can use HID API). Keystrokes are sent as Input Reports.
This may be a trivial question, but I'm not sure what is the best way to being kept notified of keystrokes without delay or performance impact (it's normal to have multiple keys in the order of milliseconds). Microsoft suggests that user mode applications should use ReadFile. So should I just have a separate thread that has an infinite loop calling ReadFile (overlapped read) and WaitForSingleObject then notify the main thread?

Best Regards,

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How to get notified of Input Reports without Delay
« Reply #1 on: July 08, 2013, 09:58:31 am »
Yes, you can use ReadFile or the .NET Filestream class with notifications. I have example code:

www.Lvr.com/hidpage.htm

Other options are DirectX's DirectInput and the Raw Input API (for system keyboards).
« Last Edit: July 08, 2013, 12:19:33 pm by Jan Axelson »