Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
registerrawinputdevices (user32)
 
.
Summary
Registers a device to send its raw input data.

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.NET 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 Shared Function RegisterRawInputDevices(<MarshalAs(UnmanagedType.LPArray, SizeParamIndex := 0)> ByVal pRawInputDevices As RAWINPUTDEVICE(), ByVal uiNumDevices As Integer, ByVal cbSize As Integer) As Boolean
End Function

User-Defined Types:

RAWINPUTDEVICE

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    private void RegisterMouse()
    {
        RAWINPUTDEVICE device;

        device.WindowHandle = this.Handle;
        device.UsagePage = 0x01;
        device.Usage = 0x02;
        device.Flags = RawInputDeviceFlags.InputSink;

        Win32API.RegisterRawInputDevices(device);
    }

    /// <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.

        devices[0] = device;
        return RegisterRawInputDevices(devices, 1, Marshal.SizeOf(typeof(RAWINPUTDEVICE)));
    }

Documentation

Please edit this page!

Do you have...

  • 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).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions