The windows. device. input interface identifies available input devices and obtains information about these devices.
Keyboardcapabilities
Used to determine whether a keyboard device is connected.
Its keyboardpresent attribute is used for judgment. If it is 0, it indicates that no connection is established. If it is not 0, it indicates that the connection is established.
Windows.Devices.Input.KeyboardCapabilities KeyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();string status = string.Format("There is {0} keyboard present\n", KeyboardCapabilities.KeyboardPresent != 0 ? "a" : "no");
Mousecapabilities
Used to determine whether a mouse device is currently connected
Its Attributes are more than those of keyboardcapabilities, as shown below:
Horizontalwheelpresent this value indicates whether there is a mouse connection with a horizontal scroll wheel
Mousepresent indicates whether a mouse connection exists.
Numberofbuttons indicates the number of buttons in the current connection. If Multiple mouse connections exist, the maximum number of mouse buttons is returned.
Swapbuttons: indicates whether the left-right switching button exists in the currently connected mouse device.
Verticalwheelpresent indicates whether a vertical scroll wheel exists in the currently connected mouse device.
Windows.Devices.Input.MouseCapabilities MouseCapabilities = new Windows.Devices.Input.MouseCapabilities(); String info = string.Format("There is {0} mouse present\n", MouseCapabilities.MousePresent != 0 ? "a" : "no"); info += string.Format("There is {0} vertical mouse wheel present\n", MouseCapabilities.VerticalWheelPresent != 0 ? "a" : "no"); info += string.Format("There is {0} horizontal mouse wheel present\n", MouseCapabilities.HorizontalWheelPresent != 0 ? "a" : "no"); info += string.Format("The user has {0}opted to swap the mouse buttons\n", MouseCapabilities.SwapButtons != 0 ? "" : "not "); info += string.Format("The mouse has {0} button(s)\n", MouseCapabilities.NumberOfButtons);
Touchcapabilities
Obtain the function of a connected touch digital device
Contats indicates the minimum number of contacts that support all digital devices
Touchpresent indicates whether the current terminal has a data analyzer.
Windows.Devices.Input.TouchCapabilities TouchCapabilities = new Windows.Devices.Input.TouchCapabilities(); String info = string.Format("There is {0} digitizer present\n", TouchCapabilities.TouchPresent != 0 ? "a" : "no");info += string.Format("The digitizer supports {0} contacts\n", TouchCapabilities.Contacts);
Pointerdevice
Identify connected pointer devices and their functions
var PointerDeviceList = Windows.Devices.Input.PointerDevice.GetPointerDevices(); string device=""; foreach (Windows.Devices.Input.PointerDevice PointerDevice in PointerDeviceList) { if (PointerDevice.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) { device ="mouse"; } else if (PointerDevice.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen) { device= "pen"; } else { device= "touch"; } }
Today, I read a little bit about the Function usage of the input device. When I studied the function of sending and receiving messages by SMS, It was just started by the smsdevice. getdefaultasync () gets information from the device and stops the device. The error is "the service has not started yet. (The exception comes from hresult: 0x80070426) ". I don't know if you want to enable it first. I hope you can remind me again. ^_^