Solved

Simple question about keyboard?

Posted on 1999-01-08
3
178 Views
Last Modified: 2013-11-20
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
Comment
Question by:kkuu
3 Comments
 

Author Comment

by:kkuu
ID: 1327414
Edited text of question
0
 

Expert Comment

by:lipanshi
ID: 1327415
open resourse Accelerator's IDR_MAINFRAME ,add your key in Accelerator's table
0
 
LVL 1

Accepted Solution

by:
jim_pettinato earned 30 total points
ID: 1327416
Use VK_NUMPAD9 - 0x60.


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 105
withoutTen challenge 14 131
Detect file exist or not 3 178
Bartender label printing - switch on and off graphics 3 54
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question