Exemple #1
0
        public static unsafe RawInputData[] GetBufferedData(int bufferSize = 8)
        {
            var itemSize = User32.GetRawInputBufferSize();

            if (itemSize == 0)
            {
                return(new RawInputData[0]);
            }

            var bytes = new byte[itemSize * bufferSize];

            fixed(byte *bytesPtr = bytes)
            {
                var count = User32.GetRawInputBuffer((IntPtr)bytesPtr, (uint)bytes.Length);

                if (count == 0)
                {
                    return(new RawInputData[0]);
                }

                var result = new RawInputData[count];

                for (int i = 0, offset = 0; i < result.Length; i++)
                {
                    var data = ParseRawInputBufferItem(bytesPtr + offset);

                    result[i] = data;
                    offset    = Align(offset + data.Header.Size);
                }

                return(result);
            }
        }
 public RawInputEventArgs(RawInputData data, IntPtr param)
 {
     Data  = data;
     Param = param;
 }
 public RawInputEventArgs(RawInputData data) : this(data, IntPtr.Zero)
 {
 }