Solved

Simple question about keyboard?

Posted on 1999-01-08
3
177 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 677
pre4 challenge 19 100
Annoying "thing" blocks my view 4 100
Increment column based of a FK 8 23
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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