用GetKeyState判断指定按键是否按下

SHORT GetKeyState(int nVirtKey /* virtual-key code,eg.VK_F1 */);
 
//If the high-order bit is 1, the key is down; otherwise, it is up.
//If the low-order bit is 1, the key is toggled.
 
//例如:
GetKeyState(VK_MENU) & 0x8000
//Alt按下
 
GetKeyState(VK_CONTROL) & 0x8000
//Ctrl按下

 

文章来自:http://www.cnblogs.com/dgx/p/5491561.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3