如何处理组合键 [英] How can I handle key combinations

查看:80
本文介绍了如何处理组合键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我想使用C ++中的按键组合来实现不同的功能
例如,当我按下"Alt + F4"时,程序将执行该操作,如果可以的话,请指导我

Thanks

hi
i want to use combination of keys in c++ to pro-from different function
for example when i press "Alt+F4" the program will and if it is posible then please guide me

thanks

推荐答案

可以在按下所需键时在keydown事件中检查特殊键.
例如,对于Alt+F4,请在按键按下事件中检查VK_F4.
按下此键时,请使用GetKeyState(VK_MENU);检查是否按下了Alt键.
You could check for special keys in the keydown event when the required key is pressed.
For example, for Alt+F4, check for VK_F4 in the key down event.
When this key is pressed use GetKeyState(VK_MENU); to check if the Alt key is pressed.


这篇关于如何处理组合键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆