RegisterRawInputDevices function (winuser.h)

Registers the devices that supply the raw input data.


BOOL RegisterRawInputDevices(
  [in] PCRAWINPUTDEVICE pRawInputDevices,
  [in] UINT             uiNumDevices,
  [in] UINT             cbSize


[in] pRawInputDevices


An array of RAWINPUTDEVICE structures that represent the devices that supply the raw input.

[in] uiNumDevices

Type: UINT

The number of RAWINPUTDEVICE structures pointed to by pRawInputDevices.

[in] cbSize

Type: UINT

The size, in bytes, of a RAWINPUTDEVICE structure.

Return value

Type: BOOL

TRUE if the function succeeds; otherwise, FALSE. If the function fails, call GetLastError for more information.


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 RIDEV_DEVNOTIFY flag for each device class that is specified by the usUsagePage and usUsage fields of the RAWINPUTDEVICE structure . By default, an application does not receive WM_INPUT_DEVICE_CHANGE notifications for raw input device arrival and removal.

If a RAWINPUTDEVICE structure has the RIDEV_REMOVE flag set and the hwndTarget parameter is not set to NULL, then parameter validation will fail.

Only one window per raw input device class may be registered to receive raw input within a process (the window passed in the last call to RegisterRawInputDevices). Because of this, RegisterRawInputDevices should not be used from a library, as it may interfere with any raw input processing logic already present in applications that load it.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-rawinput-l1-1-0 (introduced in Windows 10, version 10.0.14393)

See also



Raw Input