https://learn.microsoft.com/ko-kr/windows/win32/api/winuser/nf-winuser-getasynckeystate

 

GetAsyncKeyState 함수(winuser.h) - Win32 apps

함수가 호출될 때 키가 작동 또는 중단되었는지 여부와 GetAsyncKeyState에 대한 이전 호출 후 키를 눌렀는지 여부를 확인합니다.

learn.microsoft.com

윈도우즈 프로그램에서 키를 눌렀는지 상태 확인용으로 사용하는 GetAsyncKeyState 함수는 입력 값으로 int vKey 를 받는다.

SHORT GetAsyncKeyState(
  [in] int vKey
);

WinUser.h 에 아래와 같이 vKey 가 정의되어 있다. shift, ctrl 은 보이는데 alt 키가 보이지 않았다.

...
#define VK_SHIFT          0x10
#define VK_CONTROL        0x11
#define VK_MENU           0x12
#define VK_PAUSE          0x13
#define VK_CAPITAL        0x14
...

검색 해보니 VK_MENU 가 Alt 키에 대응되는 virtual key code 였다.

https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

 

Virtual-Key Codes (Winuser.h) - Win32 apps

The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.

learn.microsoft.com

 

728x90

+ Recent posts