CoreWindow.GetCurrentKeyEventDeviceId 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 unique ID for the input device that generated this key event.
GetCurrentKeyEventDeviceId is not supported for all input devices.
public:
virtual Platform::String ^ GetCurrentKeyEventDeviceId() = GetCurrentKeyEventDeviceId;
winrt::hstring GetCurrentKeyEventDeviceId();
public string GetCurrentKeyEventDeviceId();
function getCurrentKeyEventDeviceId()
Public Function GetCurrentKeyEventDeviceId () As String
A unique identifier for the input device associated with the key event, or an empty string. The same device can be assigned a different ID each time it is connected.
After a key event is processed, this method returns an empty string.
Device family |
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v3.0)
|
Use GetCurrentKeyEventDeviceId to differentiate between devices that can generate key events, such as multiple game controllers. The device id is useful for associating the input device with a specific user account.
To get a valid device ID, this method must be called from your KeyUp and KeyDown event handlers.
Product | Versions |
---|---|
WinRT | Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |