Solved

Help with WM_KEYDOWN

Posted on 1997-11-08
2
357 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 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

19 Experts available now in Live!

Get 1:1 Help Now