Click to See Complete Forum and Search --> : Catching pressed keys in MFC Dialog?


krompo
January 19th, 2005, 07:43 AM
hi everyone!

Could somebody help? I have an app wizard generated dialog based app. I want to be able to catch keyboard presses similiar (or the same way) as it is done in a standard SDI/MDI MFC generated app. So for instance, if a user presses (while over/in my dialog) ctrl-C, I want to be able to know that the user pushed ctrl-C so I can handle it.

Since standard dialogs do not have accelerator tables, how to accomplish this task in a dialog? I tried to override PreTranslateMessage (so I can catch the 'c' pressed by intercepting WM_CHAR) but have no idea how to find out whether the CTRL key was pressed as well. please help.

thanks,
krompo

Mutilated1
January 19th, 2005, 02:59 PM
You use the WPARAM in the WM_CHAR to determine that its a 'C' right ? All the information about the ALT key, the CTRL key, etc... is in the LPARAM. I don't remember exactly how it works, but if you trap the message and examine the LPARAM a few times I am sure you will figure it out.