Handling keyboard input in a dialog procedure.

This is a discussion on Handling keyboard input in a dialog procedure. within the Windows Programming forums, part of the Platform Specific Boards category; How do I handle it. It seems like Dialog Procedures don't handle WM_KEYDOWN or WM_KEYUP messages. Am I wrong. If ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    26

    Handling keyboard input in a dialog procedure.

    How do I handle it. It seems like Dialog Procedures don't handle WM_KEYDOWN or WM_KEYUP messages. Am I wrong.

    If I press the '1' key, how can I use it to call a button procedure.

    I don't have a window procedure. All I have in WinMain is
    this

    return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc);
    Last edited by ganonl; 08-22-2003 at 05:22 PM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Well the last param to that DialogBox should be your dialog's message proc. What you need to do is handle the message WM_GETDLGCODE and then return the value DLGC_WANTALLKEYS stating you want to receive messages regarding key events. That should do it.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    26
    <i>Handle WM_GETDLGCODE and then return the value DLGC_WANTALLKEYS</i>

    You mean just put this in my Dialog procedure??

    Code:
    case WM_GETDLGCODE:
                    return DLGC_WANTALLKEYS;
    break;
    What do I do after that?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interacting with keyboard input.
    By Devils Child in forum C# Programming
    Replies: 4
    Last Post: 06-05-2009, 12:06 AM
  2. Help using inline assembly for keyboard input
    By sleventeen in forum C Programming
    Replies: 7
    Last Post: 05-10-2009, 01:31 AM
  3. Keyboard Input
    By CaliJoe in forum C++ Programming
    Replies: 3
    Last Post: 05-08-2009, 09:51 AM
  4. FAQ Keyboard Input ? (C++)
    By Malikive in forum FAQ Board
    Replies: 6
    Last Post: 11-07-2001, 08:30 PM
  5. Keyboard input ?
    By Malikive in forum Game Programming
    Replies: 4
    Last Post: 11-06-2001, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21