Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
RegisterRawInputDevices (user32)
.
C# Signature:
/// <summary>
/// Function to register a raw input device.
/// </summary>
/// <param name="pRawInputDevices">Array of raw input devices.</param>
/// <param name="uiNumDevices">Number of devices.</param>
/// <param name="cbSize">Size of the RAWINPUTDEVICE structure.</param>
/// <returns>TRUE if successful, FALSE if not.</returns>
[DllImport("user32.dll")]
public static extern bool RegisterRawInputDevices([MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] RAWINPUTDEVICE[] pRawInputDevices, int uiNumDevices, int cbSize);
VB Signature:
Declare Function RegisterRawInputDevices Lib "user32.dll" (TODO) As TODO
User-Defined Types:
Enumerations:
/// <summary>
/// Enumeration containing flags for a raw input device.
/// </summary>
[Flags()]
public enum RawInputDeviceFlags
{
/// <summary>No flags.</summary>
None = 0,
/// <summary>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.</summary>
Remove = 0x00000001,
/// <summary>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 PageOnly.</summary>
Exclude = 0x00000010,
/// <summary>If set, this specifies all devices whose top level collection is from the specified usUsagePage. Note that Usage must be zero. To exclude a particular top level collection, use Exclude.</summary>
PageOnly = 0x00000020,
/// <summary>If set, this prevents any devices specified by UsagePage or Usage from generating legacy messages. This is only for the mouse and keyboard.</summary>
NoLegacy = 0x00000030,
/// <summary>If set, this enables the caller to receive the input even when the caller is not in the foreground. Note that WindowHandle must be specified.</summary>
InputSink = 0x00000100,
/// <summary>If set, the mouse button click does not activate the other window.</summary>
CaptureMouse = 0x00000200,
/// <summary>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. NoHotKeys can be specified even if NoLegacy is not specified and WindowHandle is NULL.</summary>
NoHotKeys = 0x00000200,
/// <summary>If set, application keys are handled. NoLegacy must be specified. Keyboard only.</summary>
AppKeys = 0x00000400
}
Value types:
/// <summary>
/// Value type for raw input devices.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct RAWINPUTDEVICE
{
/// <summary>Top level collection Usage page for the raw input device.</summary>
public short UsagePage;
/// <summary>Top level collection Usage for the raw input device. </summary>
public short Usage;
/// <summary>Mode flag that specifies how to interpret the information provided by UsagePage and Usage.</summary>
public RawInputDeviceFlags Flags;
/// <summary>Handle to the target device. If NULL, it follows the keyboard focus.</summary>
public IntPtr WindowHandle;
}
/// <summary>
/// Function to register a raw input device.
/// </summary>
/// <param name="device">Device information.</param>
/// <returns>TRUE if successful, FALSE if not.</returns>
public static bool RegisterRawInputDevices(RAWINPUTDEVICE device)
{
RAWINPUTDEVICE[] devices = new RAWINPUTDEVICE[1]; // Raw input devices.
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).