Create 3 new classes for readWrite form. They are HID(), win32Keyboard() and handler()
Integrate the classes into one.
Spot out the correct process name of the foreground process, then send some hard-coded byte values to the device
Can read report from device and split it into two modes. The first is modifier and another is non-modifier. Modifier consists of 8Bits defined in HID1_11.pdf. Non-modifier somehow can be found by simple maths.
Create an ArrayList to store all key pressed first and released all of them at once.
Going to implement:
Make our process running in background. Reference:
Optimize the program, maybe by minimizing the code size and introducing some algorithms.
Start debugging. Finding any possible bugs.
Get URL from Hwnd, have to try.
Find a way to register hot-key in windows
The format of the HID report is vital for decoding the meaning inside the report.
Page 70 of the HID1_11.pdf which can be downloaded from the USB official website is useful.
Oct 4, 2010
Finished wrapping the HID API library with C# codes. A reading thread is responsible for reading something from the widget.
Following to do are:
Study the pattern of the values returned. If I press a, b and c at the same time, the pattern becomes 00 00 04 05 06 00... If only a is pressed, it is 00 00 04 00 00 ... If only b is pressed, it is 00 00 05 00 00... We should write a "clever" function to analyze it.
Integrate the getForegroundProcess program with this library.
Figure out what should be sent to the widget to identify current running process.
The bugs that make the program unable to read and write data:
I forgot to change the flags and control type respectively.
To write something, nAccess = GENERIC_WRITE; nsharemode= nShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; controlType= 0x02... It is similar if we want to read something.
The overlapped structure is vital for ReadFile to call. It is originally a blocking call. However, we can change its behavior by feeding an overlapped structure to it. Refers to MSDN, the passage about Readfile.
Acknowledgement (HID class only) and some follow-up explanation:
createFile is called with many arguments. These arguments should also be called from other winAPIs. We have to provide GUID at some points... (refer to the openDev src code in the class HID and also documentation from MSDN)
Make reference to genericHID.cs and its author. It gives definition of each winAPI function useful for our HID class.