jwillmer
jwillmer

Reputation: 3790

How to listen to keypress event in a background task

I have a barcode scanner that will be recognized as a keyboard by Windows (IoT) and I like to write a IBackgroundTask that fires an event if a new barcode was scanned. How can I listen to the keypress event of the keyboard in a background task on Windows IoT?

Upvotes: 0

Views: 903

Answers (1)

Whyan
Whyan

Reputation: 134

Have a look at the following discussion (describes using a keyboard hook in c# in windows mobile 6.5): http://www.intermec.com/site/realtime/SingleArticleList.aspx?id=17093 Unfortunately there is not a message pump in Windows 10 IoT Core (as there is no gui), so this sample won't work for you. A much better solution would be to utilize an serial port barcode scanner, setup a thread to listen to the serial port and then do your processing. An example of listening to the serial port is here: https://developer.microsoft.com/en-us/windows/iot/win10/samples/serialsample Any serial port scanner will do (such as the Motorola Symbol LS2208)

Upvotes: 1

Related Questions