CoreWindow.GetKeyState(VirtualKey) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the state of a virtual key.
public:
virtual CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey) = GetKeyState;
CoreVirtualKeyStates GetKeyState(VirtualKey const& virtualKey);
public CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey);
function getKeyState(virtualKey)
Public Function GetKeyState (virtualKey As VirtualKey) As CoreVirtualKeyStates
- virtualKey
- VirtualKey
The virtual key for which state is returned.
The flags indicating the current state of the supplied virtual key when the input event fired.
Note
For WinUI 3 apps, this method returns null. Use Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread instead.
All keys support the Locked state (not just the standard Caps Lock and Num Lock keys).
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |
- <xref:Windows.UI.Core.CoreVirtualKeyStates%0a*+M%3aWindows.UI.Core.CoreWindow.GetAsyncKeyState(Windows.System.VirtualKey)%0a*+%5bInputKeyboardSource.GetKeyStateForCurrentThread%5d(%2fwindows%2fwindows-app-sdk%2fapi%2fwinrt%2fmicrosoft.ui.input.inputkeyboardsource.getkeystateforcurrentthread)>