Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90582
  • 博文数量: 50
  • 博客积分: 1086
  • 博客等级: 少尉
  • 技术积分: 420
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-25 16:16
文章分类
文章存档

2011年(50)

我的朋友

分类: WINDOWS

2011-11-15 18:47:47

  1. void CEXForKeyDlg::OnButtonStart()
  2. {
  3.  // TODO: Add your control notification handler code here
  4.  CString str="start this game for debugging.\r\n";
  5.  ShowInfo(str);
  6. }



  7. void CEXForKeyDlg::OnButtonEnd()
  8. {
  9.  // TODO: Add your control notification handler code here
  10.  CString str="end this game for debugging.\r\n";
  11.  ShowInfo(str);
  12. }

  13. void CEXForKeyDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  14. {
  15.  // TODO: Add your message handler code here and/or call default
  16.  switch(nChar)
  17.  {
  18.  case 'S':
  19.   if(!m_bCheckKey[0])
  20.   {
  21.    OnButtonStart();
  22.    m_bCheckKey[0]=TRUE;
  23.   }
  24.   break;
  25.   CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
  26. }

  27. void CEXForKeyDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
  28. {
  29.  // TODO: Add your message handler code here and/or call default
  30.  switch(nChar)
  31.  {
  32.  case 'S':OnButtonEnd();m_bCheckKey[0]=FALSE;break;
  33.   }
  34.  CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
  35. }



  36. BOOL CEXForKeyDlg::PreTranslateMessage(MSG* pMsg)
  37. {
  38.  // TODO: Add your specialized code here and/or call the base class
  39.  if(pMsg->message==WM_KEYDOWN)
  40.  {
  41.   SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
  42.   return true;
  43.  }
  44.  else if(pMsg->message==WM_KEYUP)
  45.  {
  46.         SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
  47.         return true;
  48.     }

  49.  return CDialog::PreTranslateMessage(pMsg);
  50. }

  51. void CEXForKeyDlg::ShowInfo(const CString& str)
  52. {
  53.  m_strEditShow+=str;
  54.  GetDlgItem(IDC_EDITSHOW)->SetWindowText(m_strEditShow);
  55.  CEdit * output=(CEdit *)GetDlgItem(IDC_EDITSHOW);
  56.  output->LineScroll(output->GetLineCount());
  57. }

ESC键 VK_ESCAPE (27)
回车键: VK_RETURN (13)
TAB键: VK_TAB (9)
Caps Lock键: VK_CAPITAL (20)
Shift键: VK_SHIFT ()
Ctrl键: VK_CONTROL (17)
Alt键: VK_MENU (18)
空格键: VK_SPACE (/32)
退格键: VK_BACK (8)
左徽标键: VK_LWIN (91)
右徽标键: VK_LWIN (92)
鼠标右键快捷键:VK_APPS (93)
Insert键: VK_INSERT (45)
Home键: VK_HOME (36)
Page Up: VK_PRIOR (33)
PageDown: VK_NEXT (34)
End键: VK_END (35)
Delete键: VK_DELETE (46)
方向键(←): VK_LEFT (37)
方向键(↑): VK_UP (38)
方向键(→): VK_RIGHT (39)
方向键(↓): VK_DOWN (40)
F1键: VK_F1 (112)
F2键: VK_F2 (113)
F3键: VK_F3 (114)
F4键: VK_F4 (115)
F5键: VK_F5 (116)
F6键: VK_F6 (117)
F7键: VK_F7 (118)
F8键: VK_F8 (119)
F9键: VK_F9 (120)
F10键: VK_F10 (121)
F11键: VK_F11 (122)
F12键: VK_F12 (123)
Num Lock键: VK_NUMLOCK (144)
小键盘0: VK_NUMPAD0 (96)
小键盘1: VK_NUMPAD1 (97)
小键盘2: VK_NUMPAD2 (98)
小键盘3: VK_NUMPAD3 (99)
小键盘4: VK_NUMPAD4 (100)
小键盘5: VK_NUMPAD5 (101)
小键盘6: VK_NUMPAD6 (102)
小键盘7: VK_NUMPAD7 (103)
小键盘8: VK_NUMPAD8 (104)
小键盘9: VK_NUMPAD9 (105)
小键盘.: VK_DECIMAL (110)
小键盘*: VK_MULTIPLY (106)
小键盘+: VK_MULTIPLY (107)
小键盘-: VK_SUBTRACT (109)
小键盘/: VK_DIVIDE (111)
Pause Break键: VK_PAUSE (19)
Scroll Lock键: VK_SCROLL (145)

阅读(636) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:CString char string等的相互转换

给主人留下些什么吧!~~