RAWINPUTDEVICE structure (winuser.h)

Defines information for the raw input devices.

Syntax

typedef struct tagRAWINPUTDEVICE {
  USHORT usUsagePage;
  USHORT usUsage;
  DWORD  dwFlags;
  HWND   hwndTarget;
} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;

Members

usUsagePage

Type: USHORT

Top level collection Usage page for the raw input device. See HID Clients Supported in Windows for details on possible values.

usUsage

Type: USHORT

Top level collection Usage ID for the raw input device. See HID Clients Supported in Windows for details on possible values.

dwFlags

Type: DWORD

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
RIDEV_REMOVE
0x00000001
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.
RIDEV_EXCLUDE
0x00000010
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 RIDEV_PAGEONLY.
RIDEV_PAGEONLY
0x00000020
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 RIDEV_EXCLUDE.
RIDEV_NOLEGACY
0x00000030
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.
RIDEV_INPUTSINK
0x00000100
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.
RIDEV_CAPTUREMOUSE
0x00000200
If set, the mouse button click does not activate the other window. RIDEV_CAPTUREMOUSE can be specified only if RIDEV_NOLEGACY is specified for a mouse device.
RIDEV_NOHOTKEYS
0x00000200
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. RIDEV_NOHOTKEYS can be specified even if RIDEV_NOLEGACY is not specified and hwndTarget is NULL.
RIDEV_APPKEYS
0x00000400
If set, the application command keys are handled. RIDEV_APPKEYS can be specified only if RIDEV_NOLEGACY is specified for a keyboard device.
RIDEV_EXINPUTSINK
0x00001000
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
RIDEV_DEVNOTIFY
0x00002000
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

hwndTarget

Type: HWND

A handle to the target window. If NULL it follows the keyboard focus.

Remarks

If RIDEV_NOLEGACY is set for a mouse or a keyboard, the system does not generate any legacy message for that device for the application. For example, if the mouse TLC is set with RIDEV_NOLEGACY, WM_LBUTTONDOWN and related legacy mouse messages are not generated. Likewise, if the keyboard TLC is set with RIDEV_NOLEGACY, WM_KEYDOWN and related legacy keyboard messages are not generated.

If RIDEV_REMOVE is set and the hwndTarget member is not set to NULL, then RegisterRawInputDevices function will fail.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header winuser.h (include Windows.h)

See also

Conceptual

GetRegisteredRawInputDevices

Raw Input

Introduction to Human Interface Devices (HID)

HID Clients Supported in Windows

HID USB homepage

Reference

RegisterRawInputDevices