Re: Dealing with a barcode scanner
Check for it in the App Class.
If(Ctrl + Alt + X)
Maybe OnSysKey() would be better than using Pretranslate message.
I am just not that experienced with using OnSysKey() to comment further.
I just use code that I stumbled across.
So, I do it all in OnPreTranslateMessage().
BOOL CSomeApp::PreTranslateMessage(MSG* pMsg)
static int m_CTRL;
static int m_SHIFT;
if(m_CTRL && m_SHIFT)
/* post to desecendants if that is what you need, or get the =
pointer to your particular control and set the focus*/
m_SHIFT = false;
m_CTRL = false; // Clear repeat count.
m_CTRL = true;
m_SHIFT = true;
Best I can conjure up with what I know.
"Mike Silva" <firstname.lastname@example.org> wrote in message =
I'm writing a small dialog app that, along with taking keyboard input
the "regular" way, also takes input from a USB barcode scanner. The
issue is, the barcode data appears as typed-in text (followed by a
RETURN) in whatever app has the current focus. The scanner appears as
a "HID Keyboard Device" in the Windows Keyboard section. The problem
this presents in my app is that the user could be in any one of my
text-entry controls when he decides to scan in an object, thus dumping
the scanned text into any old text-entry control that happens to have
the focus at the moment. The only good news is, I can specify the
barcode text format and can thus pick out a barcode from any piece of
The best solution, pretty clearly, is if I could catch the incoming
barcode scan before it gets into the keyboard data stream, but I have
no idea if this is possible, or how I would do it. If it's not
possible then it seems that I have to check each and every text-entry
control when a RETURN is detected, extract the barcode, and then clean
up the potentially trashed text in that control.
Are there any words of wisdom that you folks can pass along regarding
this situation? Can I read the two keyboards differently? Any help