MicrosoftDocs / feedback

📢 docs.microsoft.com site feedback
https://learn.microsoft.com
Creative Commons Attribution 4.0 International
239 stars 160 forks source link

Information at GetRawInputData page seems to conflict with example at Using Raw Input page #3763

Open Wallby opened 2 years ago

Wallby commented 2 years ago

Describe the bug At the GetRawInputData page there is.. .. RID_HEADER to "get the header information" .. RID_INPUT to "get the raw data" However at https://docs.microsoft.com/nl-nl/windows/win32/inputdev/using-raw-input only RID_INPUT is set yet the header variable is then read from, which according to the GetRawInputData page should not have been "gotten".

GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
LPBYTE lpb = new BYTE[dwSize];
if (lpb == NULL) 
{
    return 0;
} 

if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize)
     OutputDebugString (TEXT("GetRawInputData does not return correct size !\n")); 

RAWINPUT* raw = (RAWINPUT*)lpb;

if (raw->header.dwType == RIM_TYPEKEYBOARD) 
{

I.e. raw->header.dwType == RIM_TYPEKEYBOARD reads from the header variable.

gewarren commented 2 years ago

FYI @tedhudek @drewbatgit

Karl-Bridge-Microsoft commented 2 years ago

Hi @Wallby - can you specify the topic you're reporting a bug for? It sounds like you're issue is with the code snippet in https://docs.microsoft.com/nl-nl/windows/win32/inputdev/using-raw-input, but I'd like to confirm.

Wallby commented 2 years ago

@Karl-Bridge-Microsoft

The snippets I pasted are an exact copy from https://docs.microsoft.com/nl-nl/windows/win32/inputdev/using-raw-input#performing-a-standard-read-of-raw-input