I am writing a class to consume 'ALL' input from barcode scanner. I am using the code from http://nicholas.piasecki.name/blog/2009/02/distinguishing-barcode-scanners-from-the-keyboard-in-winforms/
I've added following lines in PreFilterMessage() for testing.
if (m.Msg != Win32.WM_INPUT)
{
// Allow any non WM_INPUT message to pass through
return false;
}
return true;
The problem is with some barcode that has "═" (Alt + Numpad: 205) in it. and it gets typed in the textbox. How can I prevent the Alt + Numpad keys from dispatching?
I am able to handle this issue by catching the keys at form level, by setting the form
keypreview=true,
and in form_keypress event setting
//if(Alt pressed && numpad keys)
e.Handled = true;
But ideally this should be handled by the class. Any ideas??