Example #1
0
        public static uint GetRawInputData(IntPtr hRawInput, uint uiCommand, out RAWINPUTHEADER data)
        {
            int size = Marshal.SizeOf(typeof(RAWINPUTHEADER));
            IntPtr buffer = Marshal.AllocHGlobal(size);
            try {
                uint result = GetRawInputData(
                    hRawInput,
                    uiCommand,
                    buffer,
                    ref size,
                    size
                );

                data = new RAWINPUTHEADER();
                Marshal.PtrToStructure(buffer, data);
                return result;
            }
            finally {
                Marshal.FreeHGlobal(buffer);
            }
        }
Example #2
0
        public static uint GetRawInputData(IntPtr hRawInput, uint uiCommand, out RAWINPUTHEADER data)
        {
            int    size   = Marshal.SizeOf(typeof(RAWINPUTHEADER));
            IntPtr buffer = Marshal.AllocHGlobal(size);

            try {
                uint result = GetRawInputData(
                    hRawInput,
                    uiCommand,
                    buffer,
                    ref size,
                    size
                    );

                data = new RAWINPUTHEADER();
                Marshal.PtrToStructure(buffer, data);
                return(result);
            }
            finally {
                Marshal.FreeHGlobal(buffer);
            }
        }