By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Exclusive access to keyboard device input.

P: n/a
I'm working on an application (OEM) using c# that uses input from a keyboard
and a USB Barcode Scanner.

I need to be able to identify keystrokes from the barcode scanner and remove
them from the message queue, regardless of what application has focus.

I can identify the keystrokes and input device by registering for raw input
(RegisterRawInputDevices) and processing the WM_INPUT message. This gives
me the keystrokes and the ability to identify the USB Scanner. I have
looked into DirectInput, but it is my understanding that it uses WM_INPUT
underneath, and gives me no more information or ability than I currently
have.

I can cancel keystrokes using WH_KEYBOARD_LL and returning "-1" from my
callback.

*** Here's The Issue ***

However, the keyboard hook (WH_KEYBOARD_LL) is processed BEFORE the raw
input (WM_INPUT). When I cancel the keystrokes in the hook, the raw input
never appears.

I'm at a loss on how to resolve this situation. I do not want to write a
device driver (keyboard filter) for the barcode scanner as the scanner is
3rd party, and I do not have control over what scanners will be used. I
feel like I'm 90% there, and there must be something simple I'm missing.

Does anybody have any ideas on:

1. Finding a way to GetRawInputData from within the WH_KEYBOARD_LL hook.
2. Finding a way to cancel keystrokes from within the Raw Input handler.
3. Alternative solution I have not explored...

Thanks,

-Steven

lo*********@dodgeit.com
(do not reply to this email, it is just for newsgroup postings)

Sep 6 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you come up with a solution to this problem, please e mail me. I am
in a similar situation. Thanks

Oct 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.