CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    26

    keyboard handling

    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


  2. #2
    Join Date
    Apr 1999
    Location
    Frankfurt, Germany
    Posts
    113

    Re: keyboard handling

    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


  3. #3
    Join Date
    Apr 1999
    Posts
    26

    Re: keyboard handling

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured