0

I have coded up a low level keyboard hook using SetWindowsHookEX() on Windows CE 4.2 and it seems to work just fine. I am able to see key events using the keyboard and a barcode scanner in notepad and other applications as desired, but I do not see the barcode scanner events in the one application that I want to collect the keys in. I still see events from the keyboard, however, so I know that the keyboard hook is still working and in the hook chain. I have even tried inserting my hook in the chain every millisecond just to see if it would make a difference, but no dice. If I flip back to notepad, it's back to working the way I want it.

I'm not sure what the other application is doing to gain control of the scanner when that application is active that prevents it from acting like a keyboard any more. Any thoughts on this would be greatly appreciated. I've done a bunch of searches without any success. I looked into trying to use RAWINPUT, but it doesn't seem to be supported in Windows CE 4.2 from what I can tell as I don't see the user32.dll in the SDK.

Mike
  • 185
  • 1
  • 1
  • 7

1 Answers1

1

There are two ways to get barcode data on most WEC devices.

  1. The keyboard wedge (where data comes in as as keyboard events)
  2. An OEM specific barcode reader API

If this other app your looking at uses option #2 then there is no keyboard data to retrieve, so it makes sense you wouldn't see any. That said, you might read this article to see if it offers any tips for your keyboard hook.

Functions exported by user32.dll in big Windows are generally found in coredll.dll in WEC/WEH.

-PaulH

PaulH
  • 7,759
  • 8
  • 66
  • 143
  • Thanks for your feedback. It seems from those options that #2 would have to be the winner since I believe that they are disabling the keyboard wedge in that application. The question then is, "how do I prove that or make this work in that case?" – Mike Oct 02 '13 at 00:03
  • 1
    You could use `dumpbin /imports` on their executables/dlls to see if they're importing the OEM's barcode reader API. If they're using the OEM specific barcode reader API, you're mostly out of luck unless you want to be really dirty and either replace the OEM's DLL with a shim or otherwise hook the API in memory. (doing this would mostly be a science project and not reliable in any real-world application) – PaulH Oct 03 '13 at 18:43
  • Thanks again for your help. It looks like dumpbin might not be available on CE 4.2. The command isn't found when I type it and I only see mention of it with Windows 5.0. I'll search around though and see if I can get that working or something similar to determine what they're doing. – Mike Oct 04 '13 at 00:52
  • 1
    You can use the CE 5.0 dumpbin on CE 4.2 binaries. – PaulH Oct 08 '13 at 21:52
  • Well, that sounds like the way to go then. Thanks! – Mike Oct 09 '13 at 01:37