Udostępnij za pośrednictwem


KeyEventArgs.DeviceId Property

Definition

Gets a unique ID for the input device that generated this key event.

Use DeviceId to differentiate between devices that can generate key events, such as multiple game controllers.

DeviceId is not supported for all input devices.

public:
 property Platform::String ^ DeviceId { Platform::String ^ get(); };
winrt::hstring DeviceId();
public string DeviceId { get; }
var string = keyEventArgs.deviceId;
Public ReadOnly Property DeviceId As String

Property Value

String

Platform::String

winrt::hstring

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.

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

This property is useful for retrieving info for a specific user account associated with the input device.

Applies to

See also