Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with WM_KEYDOWN

Posted on 1997-11-08
2
Medium Priority
?
429 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 150 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 anti-spam), the admin…
Suggested Courses

886 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