佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1059|回复: 1

C++ Keypress

[复制链接]
发表于 21-10-2008 10:12 AM | 显示全部楼层 |阅读模式
Hi all,

I am newbie in C++, i have a project to check the stuck key of keyboard using VC++ MFC Dialog. Only one key can be press at same time.

example:
I pressed and hold 'a' and then press 'b'. It should prompt out an error message regarding there was more than 1 key pressed.

Below is my coding, i only able to detect a key pressed. If the 'a' key haven't release, 'b' key pressed, it will go in the sub-program and display 'b' key pressed.

What pragrameter i should using in MFC library to check there is more than 1 key pressed?

Thanks.



  1. BOOL Test_0Dlg::PreTranslateMessage(MSG* pMsg)
  2. {
  3. // TODO: Add your specialized code here and/or call the base class
  4. MSG* msg=(MSG*)pMsg;
  5. if(pMsg->message==WM_KEYDOWN)
  6. {
  7. // sub-program
  8. }
  9. return 0;
  10. }
复制代码
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 22-10-2008 12:42 PM | 显示全部楼层
I able to check the key status using 'GetKeyboardState'.

thanks a lot.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-12-2025 04:38 AM , Processed in 0.105307 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表