积极答复者
检测多个按键同时按下问题

问题
-
用GetAsyncKeyState定时循环测试0-9按键,当10按键同时按下时只检测到按键1-4和7-0,当先同时按5和6键时其它键就检测不到。不知是啥原因??
void CMKeysDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CString txt;
for(int i = 0; i < 10; i ++)
{
txt.AppendFormat("%2d-0x%8X\r\n", i+1, GetAsyncKeyState(TstKeys[i]));
}
GetDlgItem(IDC_STATIC)->SetWindowTextA(txt);
CDialog::OnTimer(nIDEvent);
}
答案
-
可以同时按下的键数和硬件有关。不同硬件支持的同时按下的键数不同。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:14
-
Windows最大能检测到的键盘同时按下的按钮数是四个.由于硬件接口原因导致的,软件无法改变.
0xBAADF00D- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:14
-
楼主要是经常用键盘玩一些游戏就知道
同时按多个键会导致部分按键信息无法传给系统
尤其是按键较近的时候
我认为这跟当前按键使电容变化传递信息有很大关系- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:15
全部回复
-
可以同时按下的键数和硬件有关。不同硬件支持的同时按下的键数不同。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:14
-
Windows最大能检测到的键盘同时按下的按钮数是四个.由于硬件接口原因导致的,软件无法改变.
0xBAADF00D- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:14
-
楼主要是经常用键盘玩一些游戏就知道
同时按多个键会导致部分按键信息无法传给系统
尤其是按键较近的时候
我认为这跟当前按键使电容变化传递信息有很大关系- 已标记为答案 Allen Chen - MSFTModerator 2009年12月8日 10:15