ReactOS 0.4.15-dev-8419-g7f0e8a3
keybd_event.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Test for keyboard inputs with flags KEYEVENTF_EXTENDEDKEY and KEYEVENTF_SCANCODE
5 * COPYRIGHT: Copyright 2021 Arjav Garg <arjavgarg@gmail.com>
6 */
7
8#include "precomp.h"
9
10static void testScancodeExtendedKey(BYTE wVk, BYTE scanCode)
11{
12 trace("wVK: %x\tScancode: %x\n", wVk, scanCode);
13
14 keybd_event(0, scanCode, KEYEVENTF_SCANCODE | KEYEVENTF_EXTENDEDKEY, 0);
15 SHORT winKeyState = GetAsyncKeyState(wVk);
16 ok(winKeyState & 0x8000, "VK=%x should be detected as key down.\n", wVk);
17
18 keybd_event(0, scanCode, KEYEVENTF_SCANCODE | KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
19 winKeyState = GetAsyncKeyState(wVk);
20 ok(!(winKeyState & 0x8000), "VK=%x should be detected as key up.\n", wVk);
21}
22
23/* https://docs.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag */
25{
42}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
static void testScancodeExtendedKey(BYTE wVk, BYTE scanCode)
Definition: keybd_event.c:10
short SHORT
Definition: pedump.c:59
#define VK_UP
Definition: winuser.h:2225
#define VK_NEXT
Definition: winuser.h:2221
#define VK_RCONTROL
Definition: winuser.h:2285
#define VK_RETURN
Definition: winuser.h:2201
#define VK_RMENU
Definition: winuser.h:2287
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_LWIN
Definition: winuser.h:2235
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define VK_LEFT
Definition: winuser.h:2224
#define KEYEVENTF_EXTENDEDKEY
Definition: winuser.h:1101
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define VK_PRIOR
Definition: winuser.h:2220
#define VK_DELETE
Definition: winuser.h:2233
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define VK_DIVIDE
Definition: winuser.h:2254
#define KEYEVENTF_KEYUP
Definition: winuser.h:1102
#define VK_INSERT
Definition: winuser.h:2232
#define VK_RWIN
Definition: winuser.h:2236
unsigned char BYTE
Definition: xxhash.c:193