identifying keystrokes

Posted on 2000-03-12
Last Modified: 2013-11-20
On my application I have an edit box in which the user enters a string.  I need to be able to tell within the OnChangeEditBox function what the last key the user pressed was, especially whether it was the delete key.

If anyone has any ideas I would be extremely grateful.  Thanks!
Question by:sjhl
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

Wyn earned 80 total points
ID: 2609694
You should subclass CEdit and create a new CMyEdit box or subclass the current CEdit control.
Then map WM_KEYUP to your CMyEdit and save the message value into a global or static variable.
Later , in your OnChangeEditFunction(),you'd check the variable to get what key was just released.

Free to ask.


Expert Comment

ID: 2609697
Btw:You can also store it in PreTranslateMessage(),first check if it's WM_KEYUP and store it.

Author Comment

ID: 2609847
Looks a great way to go about it.
However I found an easier method suitable for my application.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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
while loop over for loop 7 119
either24  challenge 19 107
haveThree challenge 22 126
Not needed 13 133
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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