コード例 #1
0
ファイル: API.cs プロジェクト: agabor/RightKeyboard
        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);
            }
        }
コード例 #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);
            }
        }