Ejemplo n.º 1
0
        /// <summary>
        /// Registers the devices that supply the raw input data.
        /// </summary>
        /// <remarks>
        /// <para>To receive <see cref="WM.INPUT">WM_INPUT</see> messages, an application must first register the raw input
        /// devices using <see cref="RegisterRawInputDevices"/>. By default, an application does not receive raw input.</para>
        /// <para>To receive <see cref="WM.INPUT_DEVICE_CHANGE">WM_INPUT_DEVICE_CHANGE</see> messages, an application must
        /// specify the <see cref="RIDEV.DEVNOTIFY"/> flag for each device class that is specified by
        /// <paramref name="usagePage"/> and <paramref name="usage"/> arguments. By default, an application does not receive
        /// <see cref="WM.INPUT_DEVICE_CHANGE">WM_INPUT_DEVICE_CHANGE</see> notifications for raw input device arrival and removal.</para>
        /// <para>If the <see cref="RIDEV.REMOVE"/> flag set and <paramref name="hwndTarget"/> is not set to <b>null</b> (IntPtr.Zero),
        /// then parameter validation will fail.</para>
        /// </remarks>
        /// <param name="flags">The flags as <see cref="RIDEV"/>.</param>
        /// <param name="usagePage">An <b>ushort</b> specifiing the usage page.</param>
        /// <param name="usage">An <b>ushort</b> specifiing the usage.</param>
        /// <param name="hwndTarget">The handle of the window, which shall receive the <see cref="WM.INPUT">WM_INPUT</see>
        /// and <see cref="WM.INPUT_DEVICE_CHANGE">WM_INPUT_DEVICE_CHANGE</see> messages.</param>
        /// <returns><b>true</b> if the function succeeds; otherwise, <b>false</b>. If the function fails, call
        /// <see cref="WinKernel.GetLastError"/> for more information.</returns>
        public static bool RegisterRawInputDevice(RIDEV flags, ushort usagePage, ushort usage, HWND hwndTarget)
        {
            RAWINPUTDEVICE pRawInputDevice = new RAWINPUTDEVICE();

            pRawInputDevice.dwFlags     = flags;
            pRawInputDevice.usUsage     = usage;
            pRawInputDevice.usUsagePage = usagePage;
            pRawInputDevice.hwndTarget  = hwndTarget;

            return(RegisterRawInputDevice(ref pRawInputDevice, 1, (uint)Marshal.SizeOf(typeof(RAWINPUTDEVICE))));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Registers the devices that supply the raw input data.
 /// </summary>
 /// <remarks>
 /// <para>To receive <see cref="WM.INPUT">WM_INPUT</see> messages, an application must first register the raw input
 /// devices using <see cref="RegisterRawInputDevices"/>. By default, an application does not receive raw input.</para>
 /// <para>To receive <see cref="WM.INPUT_DEVICE_CHANGE">WM_INPUT_DEVICE_CHANGE</see> messages, an application must
 /// specify the <see cref="RIDEV.DEVNOTIFY"/> flag for each device class that is specified by the
 /// <see cref="RAWINPUTDEVICE.usUsagePage">usUsagePage</see> and <see cref="RAWINPUTDEVICE.usUsage">usUsage</see>
 /// fields of the <see cref="RAWINPUTDEVICE"/> structure. By default, an application does not receive
 /// <see cref="WM.INPUT_DEVICE_CHANGE">WM_INPUT_DEVICE_CHANGE</see> notifications for raw input device arrival and removal.</para>
 /// <para>If a <see cref="RAWINPUTDEVICE"/> structure has the <see cref="RIDEV.REMOVE"/> flag set and the
 /// <see cref="RAWINPUTDEVICE.hwndTarget">hwndTarget</see> parameter is not set to <b>null</b> (IntPtr.Zero),
 /// then parameter validation will fail.</para>
 /// </remarks>
 /// <param name="pRawInputDevice">A <see cref="RAWINPUTDEVICE"/> structure that represent the
 /// devices that supply the raw input.</param>
 /// <returns><b>true</b> if the function succeeds; otherwise, <b>false</b>. If the function fails, call
 /// <see cref="WinKernel.GetLastError"/> for more information.</returns>
 public static bool RegisterRawInputDevice(RAWINPUTDEVICE pRawInputDevice)
 {
     return(RegisterRawInputDevice(ref pRawInputDevice, 1, (uint)Marshal.SizeOf(typeof(RAWINPUTDEVICE))));
 }
Ejemplo n.º 3
0
 extern static bool RegisterRawInputDevice([In] ref RAWINPUTDEVICE pRawInputDevice, uint uiNumDevices, uint cbSize);