What criteria does Windows use to set the usFlags in the RAWMOUSE message after parsing the HID absolute mouse device data?

yuan chen 10 Reputation points
2024-02-29T10:11:34.9366667+00:00

What criteria does Windows use to set the usFlags in the RAWMOUSE message after parsing the HID absolute mouse device data?User's image

After installing the Windows Update KB5023702,we notice that the usFlags in the RAWMOUSE message changes from 0x03 to 0x01, which is obtained from the HID absolute mouse data by Windows. This change means that the usFlags loses the value MOUSE_VIRTUAL_DESKTOP (0x02).

What's the reason for this change?And what can we do to add the value MOUSE_VIRTUAL_DESKTOP back if we still need KB5023702?

Before installing the patch (KB5023702): User's image

After installing the patch (KB5023702):User's image

Demo of Windows listening to mouse events:

switch (Msg)
{
case WM_INPUT:
    GetRawInputData((HRAWINPUT)lParam, RID_INPUT, &rawInput, &headerSize, sizeof(rawInput.header));
    if (rawInput.header.dwType == RIM_TYPEMOUSE)
    {
        if ((rawInput.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) == MOUSE_MOVE_ABSOLUTE)
        {
            printf("Received absolute mouse 0x%x 0x%8.8x 0x%8.8x buttonData 0x%x, buttons 0x%x in %s mode from device",
                    rawInput.data.mouse.usFlags, rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY,
                    rawInput.data.mouse.usButtonData, rawInput.data.mouse.ulButtons,
                    (GET_RAWINPUT_CODE_WPARAM(wParam) == RIM_INPUT
                        ? "foreground"
                        : "background"));
            printf("\n");
        }
        else
        {
            printf("Received relative mouse 0x%x 0x%8.8x 0x%8.8x buttonData 0x%x, buttons 0x%x in %s mode from device",
                    rawInput.data.mouse.usFlags, rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY,
                    rawInput.data.mouse.usButtonData, rawInput.data.mouse.ulButtons,
                    (GET_RAWINPUT_CODE_WPARAM(wParam) == RIM_INPUT
                        ? "foreground"
                        : "background"));
            printf("\n");
        }
    }
    return 0;
default:
    return DefWindowProc(hWnd, Msg, wParam, lParam);
}
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,304 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.