// DEMO3_12.CPP - GetAsynKeyState Demo
// INCLUDES //GetAsyncKeyState/
#define WIN32_LEAN_AND_MEAN // just say no to MFC
#include <windows.h> // include all the windows headers
#include <windowsx.h> // include useful macros
#include <mmsystem.h> // very important and include WINMM.LIB too!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// DEFINES
// defines for windows
#define WINDOW_CLASS_NAME "WINCLASS1"
// MACROS /
#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
/*
0x8000二进制值是1000000000000000,两者进行与运算
即如果GetAsyncKeyState(vk_code)最高位是1,则取值1,
即此时KEYDOWN 后者正好相反
函数GetAsyncKeyState确定在调用它时某个按键处于弹起还是按下的,以及此按键是否在上一次调用GetAsyncKeyState之后(“又”)按下过(重复也算按下)。
这句话的完整