• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Simple question about keyboard?

Hi All,

I have used the function PreTranslateMessage to check which
key is pressed by the user. But I don't know how to check the following keys (NUMPAD, ALT, SHIFT, ESCAPE, CTRL, etc)

BOOL CMyEditView::PreTranslateMessage(MSG* pMsg)
{
      if (pMsg->lParam=='SHIFT')
            AfxMessageBox("SHIFT PRESSED");
      if (pMsg->lParam=='CTRL')
            AfxMessageBox("CTRL PRESSED");
      if (pMsg->wParam=='9')
            AfxMessageBox("9 Pressed");

             // go to porcess another function when NUMPAD BUTTON NO 9 is pressed.....
             // when other buttons such as key ' 9', 'Shift+9', 'Ctrl+9' is pressed, nothing will be done
      return CFormView::PreTranslateMessage(pMsg);
}

Really, I only want to know whether the user had the NUMPAD Button only...I will not process my function when the user pressed key '9', 'Shift+9', 'Ctrl+9'. (the 9 here is the key not at the right hand side of the keyboard);
My function will only be processed when the user had pressed the Numpad button no.9.

How can I do this?

Thanks!!!
0
kkuu
Asked:
kkuu
1 Solution
 
kkuuAuthor Commented:
Edited text of question
0
 
lipanshiCommented:
open resourse Accelerator's IDR_MAINFRAME ,add your key in Accelerator's table
0
 
jim_pettinatoCommented:
Use VK_NUMPAD9 - 0x60.


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now