Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message handling in MFC dialog based application

Status
Not open for further replies.

gkurguzov

Programmer
Nov 21, 2001
2
US
Hi. I just have no idea why my MFC dialog-based programm doesn't respond to a Windows WM_KEYDOWN or WM_KEYUP messages, which are supposed to be sended by framework whenever a user types a key. I have used those messages in programming MFC SDI and MDI applications, but for some reason in a dialog-based application it doesn't seem working. Could that possibly be an error in Visual C++, or may be I just don't know something that's happening.
Please if you know the answer, or at least have any idea HELP!!! Cause I've searched all the MSDN library and look in all my VC++ books, but didn't find anything like that.

Thank you! George.
 
I am not certain. I have never done this but it looks very promising.

When you have your ClassView workspace displayed, right click on your dialog class. Click on Add Windows Message Handler.

I created a new new dialog project and I say the keyup and keydown on the list.

Tim
 
I played around with this some more and I figured out that you obviously know how to add the message handlers but they just don't work. I found this website:


It had this snipet near the bottom:

----------------
But this new code will do NOTHING if you don't do something more: you must edit your controls' properties and check their DISABLED check box. IF the controls are enabled, then they will get the input focus, meaning that the keyboard messages will be sent to them and the cursor changes will have no effect.
---------------

On my sample Dialog based program I disabled (by going into the properties of the buttons) the OK and the cancel and sure enough the Keyup and KeyDown message handlers worked. So I guess that solves your problem....As long as you don't have any buttons that need pushing...Ha.

Anyone else want to give it a crack?

Tim
 
Wow! Thanks Tim. This is much better then what I had before, but unfortunately I still need my dialog controls to be enabled. Well, seem like I run into another problem by solving this one. But still, I feel like i'm on half of my way to solve the entire problem, thanks you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top