Click to See Complete Forum and Search --> : keyboard handling


chandra_s
April 23rd, 1999, 02:50 PM
I need to trap WM_SYSKEYDOWN for each edit
control on a dialog and if ALT and a number is pressed , I need to ignore it.
This is in order to prevent special characters
from being entered in the edit boxes using
ALT+numeric keypad. How do I trap WM_SYSKEYDOWN
for each child control for a window in the window class? I can write WM_SYSKEYDOWN message handlers for each edit control but I don't want to do that as there are too many controls and too many dialogs. Better still, is there a way I can write a global Syskeydown handler that will handle system keys for the entire app and not just for a specific dialog? i.e. when the app is active, this handler will kick in and prevent the ALT+number key sequence.
I need to know this urgently. Any help/pointers will be greatly appreciated.
Thanks,
--Chandra

Rudolf
April 26th, 1999, 01:44 AM
Hi,
for this problem I'd simply derive a class from CEdit that overrides OnSysKeyDown and use this class for all of the editboxes.
Perhaps a well positioned PreTranslateMessage() or WindowProc() can do this, too.
Hope that helos,
Rudolf

chandra_s
April 26th, 1999, 02:36 PM
Hi,
Thanks for the help. That would be the best way to do it. But unfortunately, my application has too many dialogs that already use CEdit for edit boxes. I would have to go and replace each of those with the new CEdit derived class. I was hoping there would be an easier way out - something that handles syskeys for the whole application.

Regards,
Chandra