Marshalling of RAWHID structure

G

Guest

Can you suggest how to marshall the bRawData[1] in the following structure??
/*
* Raw format of the input from Human Input Devices
*/
typedef struct tagRAWHID {
DWORD dwSizeHid; // byte size of each report
DWORD dwCount; // number of input packed
BYTE bRawData[1];
} RAWHID, *PRAWHID, *LPRAWHID;

I have found the following:
[StructLayout(LayoutKind.Explicit)]
public struct RAWINPUT
{
[FieldOffset(0)] public RAWINPUTHEADER header;
[FieldOffset(16)] public RAWMOUSE mouse;
[FieldOffset(16)] public RAWKEYBOARD keyboard;
[FieldOffset(16)] public RAWHID hid;
}
[StructLayout(LayoutKind.Explicit)]
public struct RAWHID
{
[FieldOffset(0)] public uint dwSizeHid; // byte size of
each report
[FieldOffset(4)] public uint dwCount; // number of input packed
[FieldOffset(8)] public byte bRawData; //winuser.h has this as BYTE
bRawData[1]...HOW SHOULD THIS BE SET UP?
}
but it only returns one byte in the structure ( should be and array of 10)
when
RAWINPUT ri = new RAWINPUT();

b = GetRawInputData(hRawInput, RawInput.RID_INPUT, ref ri, ref
pcbSize,Marshal.SizeOf(typeof(RAWINPUTHEADER)));

is called. CAN SOMEONE SUGGEST HOW TO SETUP THE STRUCTURE AND
GetRawInputData()???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top