Reputation: 21761
I'm writing a Windows 8 game. The game runs on Windows 7, Windows Phone, and XBox.
I want to display keyboard hints if a keyboard is attached (e.g. 'Press Esc to exit')
Seeing as Windows 8 can be a desktop, laptop, or tablet, there may or may not be a physical keyboard attached. Is there a way to determine this programmatically?
Upvotes: 9
Views: 9268
Reputation: 372
Of course, please read this quick start here
private void GetKeyboardProperties()
{
KeyboardCapabilities keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
KeyboardPresent.Text = keyboardCapabilities.KeyboardPresent != 0 ? "Yes" : "No";
}
or if you html5/js developer take a look here.
Upvotes: 9