简体   繁体   中英

UWP - How to check NumLock and CapsLock status?

How can check for CapsLock or NumLock status and see if they are enabled or disabled (on or off)? As far as I searched, I know only it's possible to check if they are pressed.

You can check it on your Page using:

var keystate = Window.Current.CoreWindow.GetKeyState(VirtualKey.NumberKeyLock);
var isNumLocked = (keystate & CoreVirtualKeyStates.Locked) != 0;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM