Applies to: desktop apps only
Performs a buffered read of the raw input data.
Syntax
UINT WINAPI GetRawInputBuffer( __out_opt PRAWINPUT pData, __inout PUINT pcbSize, __in UINT cbSizeHeader );
Parameters
- pData [out, optional]
-
Type: PRAWINPUT
A pointer to a buffer of RAWINPUT structures that contain the raw input data. If NULL, the minimum required buffer, in bytes, is returned in *pcbSize.
- pcbSize [in, out]
-
Type: PUINT
The size, in bytes, of a RAWINPUT structure.
- cbSizeHeader [in]
-
Type: UINT
The size, in bytes, of the RAWINPUTHEADER structure.
Return value
Type: UINT
If pData is NULL and the function is successful, the return value is zero. If pData is not NULL and the function is successful, the return value is the number of RAWINPUT structures written to pData.
If an error occurs, the return value is (UINT)-1. Call GetLastError for the error code.
Remarks
Using GetRawInputBuffer, the raw input data is buffered in the array of RAWINPUT structures. For an unbuffered read, use the GetMessage function to read in the raw input data.
The NEXTRAWINPUTBLOCK macro allows an application to traverse an array of RAWINPUT structures.
Note To get the correct size of the raw input buffer, do not use *pcbSize, use *pcbSize * 8 instead. To ensure GetRawInputBuffer behaves properly on WOW64, you must align the RAWINPUT structure by 8 bytes. The following code shows how to align RAWINPUT for WOW64.
[StructLayout(LayoutKind.Explicit)]
internal struct RAWINPUT
{
[FieldOffset(0)]
public RAWINPUTHEADER header;
[FieldOffset(16+8)]
public RAWMOUSE mouse;
[FieldOffset(16+8)]
public RAWKEYBOARD keyboard;
[FieldOffset(16+8)]
public RAWHID hid;
}
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- GetMessage
- RAWINPUT
- RAWINPUTHEADER
- NEXTRAWINPUTBLOCK
- Conceptual
- Raw Input
Send comments about this topic to Microsoft
Build date: 5/5/2012
