Solved

Help with WM_KEYDOWN

Posted on 1997-11-08
2
388 Views
Last Modified: 2013-11-20
Help,
I Can't Get the WM_KEYDOWN handler, using OnKeyDown to work in a dialog base application.

The program never runs OnKeyDown, when a key is pressed.
 
Eric
0
Comment
Question by:Erics
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1309630
You cannot handle WM_KEYDOWN message in Dialog based applications. Istaed, overwrite your CDialog derived class' PreTranslateMessage function and check whether message filad of pMsg structure is WM_KEYDOWN
BOOL CYourDialog::PreTranslateMessage( MSG* pMsg )
{
if(pMsg->message == WM_KEYDOWN)
{
 // do whatever you want
return TRUE; // important!!!, do not call base class             //implementation in this case
}

return CDialog::PreTranslateMessage( pMsg );

}

0
 

Author Comment

by:Erics
ID: 1309631
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
bobThere java chalenge 45 94
Excel Use VBA to get user's Mac Address for their computer 5 240
unable to delete all specified values regedit 38 538
Detect file exist or not 3 177
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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