-1

The requirement is that when I launch the "Notepad" by my application button and keep the "Notepad" in focus, then I scan a bar-code using my bar-code scanner. There will be a string in the "Notepad" and the string is captured in my application in background via USB port.

Now the keyboard codes were captured by my winform application in the background, but I can not parse the keyboard codes to the real strings scanned by the scanner. For example, I got a real "abcDEFghi123" in the "Notepad", but I got a keyboard strings like "ABCShiftkeyDEFShiftkeyFGHID1D2D3" in my winform program and I got the strings"ABCDEFFGHI123" in the textbox control. So could anyone help me to parse the keyboard code strings to real strings "abcDEFghi123"? The Scanned barcode and real strings

And the sample code is My sample code developed by visual studio 2015

Any advice and suggestions will be greatly appreciated.

Kevin.Yang
  • 33
  • 6

1 Answers1

0

Why make the detour over Notepad? The Barcode Scanner should be able to send the keycodes to a text filed inside your application as long as you give it focus before scanning...

If that's not an option then you should be able to use KeysConverter to get the right character. (Can't test it right now)

Failing that you should be able to use additional properties of KeyEventArgs like Shift to determine if a character is upper or lower case.

Community
  • 1
  • 1
Kempeth
  • 1,856
  • 2
  • 22
  • 37
  • I need to process the bar-code scanning process in a third party application and at the same time my application should process the bar-code scanning in background. Thank you very much for the "KeysConverter" solution, but I did not find the final method. I really want to translate the windows messages to real characters. Because of the difference between different scanners, the prefix and suffix difference reason, so I need to translate the windows messages in to real characters in my final solution. Thank you again for help! – Kevin.Yang Apr 28 '17 at 02:11