Enumerates the raw input devices attached to the system.
An array of
If pRawInputDeviceList is
The size of a
If the function is successful, the return value is the number of devices stored in the buffer pointed to by pRawInputDeviceList.
On any other error, the function returns (UINT) -1 and GetLastError returns the error indication.
The devices returned from this function are the mouse, the keyboard, and other Human Interface Device (HID) devices.
To get more detailed information about the attached devices, call GetRawInputDeviceInfo using the hDevice from
Retrieves the information about the raw input devices for the current application.
An array of
The number of
The size, in bytes, of a
If successful, the function returns a non-negative number that is the number of
If the pRawInputDevices buffer is too small or
To receive raw input from a device, an application must register it by using RegisterRawInputDevices.
Retrieves information about the raw input device.
A handle to the raw input device. This comes from the lParam of the WM_INPUT message, from the hDevice member of
Specifies what data will be returned in pData. This parameter can be one of the following values.
Value | Meaning |
---|---|
| pData points to a string that contains the device name. For this uiCommand only, the value in pcbSize is the character count (not the byte count). |
| pData points to an |
| pData points to the previously parsed data. |
?
A reference to a buffer that contains the information specified by uiCommand. If uiCommand is sizeof(
before calling GetRawInputDeviceInfo.
The size, in bytes, of the data in pData.
If successful, this function returns a non-negative number indicating the number of bytes copied to pData.
If pData is not large enough for the data, the function returns -1. If pData is
Call GetLastError to identify any other errors.
Registers the devices that supply the raw input data.
An array of
The number of
The size, in bytes, of a
TRUE if the function succeeds; otherwise,
To receive WM_INPUT messages, an application must first register the raw input devices using RegisterRawInputDevices. By default, an application does not receive raw input.
To receive WM_INPUT_DEVICE_CHANGE messages, an application must specify the
If a
Performs a buffered read of the raw input data.
A reference to a buffer of
The size, in bytes, of a
The size, in bytes, of the
If pData is
If an error occurs, the return value is (UINT)-1. Call GetLastError for the error code.
Using GetRawInputBuffer, the raw input data is buffered in the array of
The NEXTRAWINPUTBLOCK macro allows an application to traverse an array of
Note??To get the correct size of the raw input buffer, do not use *pcbSize, use *pcbSize * 8 instead. To ensure GetRawInputBuffer behaves properly on WOW64, you must align the
[StructLayout(LayoutKind.Explicit)]
internal struct
{ [FieldOffset(0)] public header; [FieldOffset(16+8)] public mouse; [FieldOffset(16+8)] public keyboard; [FieldOffset(16+8)] public hid;
}
Retrieves the raw input from the specified device.
A handle to the
The command flag. This parameter can be one of the following values.
Value | Meaning |
---|---|
| Get the header information from the |
| Get the raw data from the |
?
A reference to the data that comes from the
The size, in bytes, of the data in pData.
The size, in bytes, of the
If pData is
If there is an error, the return value is (UINT)-1.
GetRawInputData gets the raw input one
Defines the raw input data coming from any device.
The size, in bytes, of the
The type of raw input data. This member can be one of the following values.
Value | Meaning |
---|---|
| Data comes from an HID that is not a keyboard or a mouse. |
| Data comes from a keyboard. |
| Data comes from a mouse. |
?
If dwType is
If dwType is
If dwType is
Defines the raw input data coming from the specified Human Interface Device (HID).
The vendor identifier for the HID.
The product identifier for the HID.
The version number for the HID.
The top-level collection Usage Page for the device.
The top-level collection Usage for the device.
Defines the raw input data coming from the specified keyboard.
For the keyboard, the Usage Page is 1 and the Usage is 6.
The type of the keyboard.
The subtype of the keyboard.
The scan code mode.
The number of function keys on the keyboard.
The number of LED indicators on the keyboard.
The total number of keys on the keyboard.
Defines the raw input data coming from the specified mouse.
For the mouse, the Usage Page is 1 and the Usage is 2.
The identifier of the mouse device.
The number of buttons for the mouse.
The number of data points per second. This information may not be applicable for every mouse device.
TRUE if the mouse has a wheel for horizontal scrolling; otherwise,
Describes the format of the raw input from a Human Interface Device (HID).
Each WM_INPUT can indicate several inputs, but all of the inputs come from the same HID. The size of the bRawData array is dwSizeHid * dwCount.
The size, in bytes, of each HID input in bRawData.
The number of HID inputs in bRawData.
The raw input data, as an array of bytes.
Contains the raw input from a device.
The handle to this structure is passed in the lParam parameter of WM_INPUT.
To get detailed information -- such as the header and the content of the raw input -- call GetRawInputData.
To read the
To get device specific information, call GetRawInputDeviceInfo with the hDevice from
Raw input is available only when the application calls RegisterRawInputDevices with valid device specifications.
The raw input data.
If the data comes from a mouse, this is the raw input data.
If the data comes from a keyboard, this is the raw input data.
If the data comes from an HID, this is the raw input data.
Defines information for the raw input devices.
If
If
Top level collection Usage page for the raw input device.
Top level collection Usage for the raw input device.
Mode flag that specifies how to interpret the information provided by usUsagePage and usUsage. It can be zero (the default) or one of the following values. By default, the operating system sends raw input from devices with the specified top level collection (TLC) to the registered application as long as it has the window focus.
Value | Meaning |
---|---|
| If set, the application command keys are handled. |
| If set, the mouse button click does not activate the other window. |
| If set, this enables the caller to receive WM_INPUT_DEVICE_CHANGE notifications for device arrival and device removal. Windows?XP:??This flag is not supported until Windows?Vista |
| If set, this specifies the top level collections to exclude when reading a complete usage page. This flag only affects a TLC whose usage page is already specified with |
| If set, this enables the caller to receive input in the background only if the foreground application does not process it. In other words, if the foreground application is not registered for raw input, then the background application that is registered will receive the input. Windows?XP:??This flag is not supported until Windows?Vista |
| If set, this enables the caller to receive the input even when the caller is not in the foreground. Note that hwndTarget must be specified. |
| If set, the application-defined keyboard device hotkeys are not handled. However, the system hotkeys; for example, ALT+TAB and CTRL+ALT+DEL, are still handled. By default, all keyboard hotkeys are handled. |
| If set, this prevents any devices specified by usUsagePage or usUsage from generating legacy messages. This is only for the mouse and keyboard. See Remarks. |
| If set, this specifies all devices whose top level collection is from the specified usUsagePage. Note that usUsage must be zero. To exclude a particular top level collection, use |
| If set, this removes the top level collection from the inclusion list. This tells the operating system to stop reading from a device which matches the top level collection. |
?
A handle to the target window. If
Contains information about a raw input device.
A handle to the raw input device.
The type of device. This can be one of the following values.
Value | Meaning |
---|---|
| The device is an HID that is not a keyboard and not a mouse. |
| The device is a keyboard. |
| The device is a mouse. |
?
Contains the header information that is part of the raw input data.
To get more information on the device, use hDevice in a call to GetRawInputDeviceInfo.
The type of raw input. It can be one of the following values.
Value | Meaning |
---|---|
| Raw input comes from some device that is not a keyboard or a mouse. |
| Raw input comes from the keyboard. |
| Raw input comes from the mouse. |
?
The size, in bytes, of the entire input packet of data. This includes
A handle to the device generating the raw input data.
The value passed in the wParam parameter of the WM_INPUT message.
Contains information about the state of the keyboard.
The scan code from the key depression. The scan code for keyboard overrun is KEYBOARD_OVERRUN_MAKE_CODE.
Flags for scan code information. It can be one or more of the following.
Value | Meaning |
---|---|
| The key is up. |
| This is the left version of the key. |
| This is the right version of the key. |
| The key is down. |
?
Reserved; must be zero.
Windows message compatible virtual-key code. For more information, see Virtual Key Codes.
The corresponding window message, for example
The device-specific additional information for the event.