tags:

views:

59

answers:

3

Hi there,

I need to write a program to modify the input of a certain usb hid keyboard (barcode scanner) under Windows. The following workflow should apply:

Listen to input from device -> record input -> stop input from getting to the active application -> process recorded input and output result to active application

So I did search for this but now I'm stuck!

There are obviously two options for "record input": the low level hook WH_KEYBOARD_LL and reacting to WM_INPUT event in Raw Input

Problem is: - with WH_KEYBOARD_LL I found no way to determine from which device the input came - in the WM_INPUT event I found no way to stop the keystroke - if WH_KEYBOARD_LL is used to stop the keystroke it won't get to Raw Input thus not triggering WM_INPUT and so I can't determine the source of the keystroke

What are my options in user mode?

Regards, Dominik

A: 

@Hans Passant: WH_KEYBOARD_LL is a global only hook, which can be set up in C#

luxifer
A: 

Sadly there is no easy way to do that. You're with your WH_KEYBOARD_LL and WM_INPUT. There might be a chance of an option though:

Have you tested whether WM_INPUT occurs before the hook? If that was the case, you could remember the characters from WM_INPUT and -- in the hook -- remove only those characters that came from your barcode scanner.

Michael
A: 

@Michael: It seems that WM_INPUT occurs after the hook, that's the problem...

PS: Sorry for not using comments... I just decided to create an account after posting this question, so I can't even comment my OP or any answers except for my own :/

luxifer