public static extern int GetRawInputData( IntPtr hRawInput, RawInputCommand command, [Out] IntPtr pData, ref uint size, int sizeHeader );
public static extern int GetRawInputData( IntPtr hRawInput, RawInputCommand command, out RawInput pData, ref int pcbSize, int cbSizeHeader );
static internal int GetRawInputData(System.IntPtr hRawInput, RawInputCommand uiCommand, System.IntPtr pData, ref int pcbSize, int cbSizeHeader) { int result = -1; try { result = UnSafeNativeMethods.GetRawInputData(hRawInput, uiCommand, pData, ref pcbSize, cbSizeHeader); } catch (System.Exception ex) { OnWin32Error(ex); result = -1; } return(result); }
public static RawInput GetRawInputData(IntPtr rawInputHandle, RawInputCommand uiCommand) { uint bufferSize = 0; uint wroteLength = GetRawInputData(rawInputHandle, uiCommand, IntPtr.Zero, ref bufferSize, (uint)Marshal.SizeOf <RawInputHeader>()); if (bufferSize <= 0 || wroteLength < 0) { throw new NativeException("GetRawInputData", Marshal.GetLastWin32Error()); } //byte[] buffer = new byte[bufferSize]; IntPtr pData = Marshal.AllocHGlobal((int)bufferSize); try { wroteLength = GetRawInputData(rawInputHandle, uiCommand, pData, ref bufferSize, (uint)Marshal.SizeOf <RawInputHeader>()); if (wroteLength != bufferSize) { throw new NativeException("GetRawInputData", Marshal.GetLastWin32Error()); } RawInput result = new RawInput(); result.Header = Marshal.PtrToStructure <RawInputHeader>(pData); result.Data = Marshal.PtrToStructure <RawInputData>(pData + Marshal.SizeOf <RawInputHeader>()); if (result.Header.Type == RawInputType.HID) { result.HidReports = new byte[result.Data.HID.Count][]; // Read the HID reports for (int i = 0; i < result.Data.HID.Count; i++) { IntPtr currentData = pData + Marshal.SizeOf <RawInputHeader>() + Marshal.SizeOf <RawInputHid>() + (i * result.Data.HID.Size); result.HidReports[i] = new byte[result.Data.HID.Size]; Marshal.Copy(currentData, result.HidReports[i], 0, result.Data.HID.Size); } } return(result); } finally { Marshal.FreeHGlobal(pData); } }
internal static extern uint GetRawInputData( IntPtr hRawInput, RawInputCommand uiCommand, IntPtr pData, ref uint pcbSize, uint cbSizeHeader);
public static extern int GetRawInputData( IntPtr hRawInput, RawInputCommand uiCommand, out RAWINPUT pData, ref int pcbSize, int cbSizeHeader);
static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, out RAWINPUT pData, ref int pcbSize, int cbSizeHeader);
public static extern int GetRawInputDeviceInfo(IntPtr hDevice, RawInputCommand uiCommand, IntPtr pData, ref int pcbSize);
public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, byte[] pData, ref int pcbSize, int cbSizeHeader);
private static extern unsafe int GetRawInputDeviceInfo(IntPtr hDevice, RawInputCommand uiCommand, void *pData, ref int pcbSize);
private static extern unsafe int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, void *pData, ref int pcbSize, int cbSizeHeader);
public static extern int GetRawInputData(System.IntPtr hRawInput, RawInputCommand uiCommand, System.IntPtr pData, ref int pcbSize, int cbSizeHeader);
public static extern int GetRawInputData(IntPtr handleRawInput, RawInputCommand command, out RawInput rawInput, ref int size, int sizeHeader);
public static extern uint GetRawInputData([In] IntPtr hRawInput, [In] RawInputCommand uiCommand, out RawInput pData, ref uint pcbSize, [In] uint cbSizeHeader);