Keyboard events, dialog boxes.

This is a discussion on Keyboard events, dialog boxes. within the Windows Programming forums, part of the Platform Specific Boards category; I have a dialog box as a resource. Here is the message loop: Code: BOOL WINAPI DlgProc(HANDLE hDlg, int msg, ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220

    Keyboard events, dialog boxes.

    I have a dialog box as a resource. Here is the message loop:
    Code:
    BOOL WINAPI DlgProc(HANDLE hDlg, int msg, int param1, long param2)
    {
      switch (msg) 
      {
        case WM_DESTROY:
          PostQuitMessage(0);
    	  return true;
        break;
        case WM_CLOSE:
          PostQuitMessage(0);
        break;
        
        case WM_KEYDOWN:
          MessageBox(0,"Hello","Hello",0);
        break;
        default: return false;
      }
    
      return false;
    }
    WM_KEYDOWN is sent when a key is pressed, as long as there are no buttons or controls on the dialog box. (I'm guessing the message is sent to the buttons and stuff rather than the dialog) How can I make it so that when the user presses enter in my EDITTEXT, the program can be told and do stuff?

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    Posts
    219
    You need to handle the EN_CHANGE notification message sent from the edit control to the parent window.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Keyboard input in a Dialog
    By ksarkar in forum C++ Programming
    Replies: 1
    Last Post: 05-20-2005, 05:39 AM
  2. Dialog Boxes
    By Thantos in forum Windows Programming
    Replies: 7
    Last Post: 08-26-2003, 12:49 PM
  3. Dialog Boxes and Sliders
    By AtomRiot in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 07:36 AM
  4. Dialog Boxes
    By cerion in forum Windows Programming
    Replies: 4
    Last Post: 06-10-2002, 06:54 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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