Thread: Editline inside dialog

  1. #1
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104

    Editline inside dialog

    I have a editline inside a dialogbox,
    how can i transer the contents in the editline into a global character-string, when the user press a OK-button in the dialog?

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    When the user presses an OK-button in the dialog, a WM_COMMAND message is sent to the dialog. Handle it by grabbing the editline text into your global character-string.

    Code:
    case WM_COMMAND:
    {
      int id = LOWORD( wParam );  // get the identifier of the control
      if( id == MY_BUTTON_ID )
      {
        GetDlgItemText( hDialog, MY_EDITLINE_ID, globalBuffer, GLOBAL_BUFFER_LENGTH );
      }
      return TRUE;
    }
    [edit]

    Forgot that we're working with dialogs. Changed return 0; to return TRUE.
    Last edited by Dante Shamest; 03-11-2005 at 09:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  4. opening a dialog window from inside a dialog window
    By uvacow in forum C++ Programming
    Replies: 1
    Last Post: 12-02-2002, 09:27 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM