检查是否同时按下了两个键 [英] Check if 2 keys are being pressed at the same time

查看:77
本文介绍了检查是否同时按下了两个键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想在基于MFC对话框的应用程序中检查如何检查 A + 1 B + 1 键是否被按下.我正在使用PreTranslateMessage(MSG * pMsg)函数检查按键,但是我不知道该怎么做按键组合.寻求帮助!

Hi, i want to check in my MFC dialog based application how to check if A + 1 or B + 1 keys are being pressed. I''m using PreTranslateMessage(MSG* pMsg) function to check keys but i don''t know what to do for key combination. Thx for help!

推荐答案

看看 ^ ]或 GetKeyState [^ ]

该组合永远不会存储在您的MSG结构中.因此,如果以上内容不适合您,您将不得不查找两条消息,一条消息传递给A,一条消息传递给1.
Have a look at GetAsyncKeyState[^] or GetKeyState[^]

The combination is never stored in your MSG struct. So if the above doesn''t cut it for you, you will have to look for two messages, one for A and one for 1.


这篇关于检查是否同时按下了两个键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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