Daniel Armstrong
Daniel Armstrong

Reputation: 849

How to get global keyboard input in UWP app without using CoreWindow.KeyDown

Since CoreWindow.KeyDown is broken in the latest few builds (6 months) of windows 10 I need an alternative way to get keyboard input. There are 3 ways of getting mouse input that I know of but I cannot find any alternative ways for keyboard input.

Are there any other methods for keyboard input in a UWP program? If so, what are they?

The issue is that CoreWindow.KeyDown events can be delayed by up to 30 seconds!

Upvotes: 2

Views: 1026

Answers (1)

AmMo
AmMo

Reputation: 11

Daniel, there is one alternative way: CoreWindow.Dispatcher.AcceleratorKeyActivated

But beware: It gives false positives e.g. when I press the Menu key (Alt) it also says that I'm pressing the Control key. Also it makes a difference between KeyDown and SystemKeyDown (I couldn't find a definition of the difference between the two), but when trying to pair the with KeyUp and SystemKeyUp you're also in for a surprise as they do not always match. :/

Anyway, if you get it to work for you then CoreWindow.Dispatcher.AcceleratorKeyActivated is the answer to your question.

Upvotes: 1

Related Questions