Solved

Simple question about keyboard?

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now