Thread: edit boxes

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    edit boxes

    What gets sent when the user presses enter while my edit box is selected, and where do i get hold of the text, and also, how can i do that in reverse, print into an edit box.

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    You'll get WM_CHAR message

  3. #3
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    yes but how do i tell it came from the edit box, and how do i get the data?

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>you get WM_CHAR

    only if you have selected the ES_WANTRETURN and ES_MULTILINE styles .

    Otherwise nothing happens if you press enter in an edit control.

    >>how do i tell it came from the edit box, and how do i get the data?

    You gave the edit a int ID when you created it (cast as the HMENU param) or in the resource editor you gave it a name.

    All messages to the edit will go thru the parents wndproc (callback).

    Switch the WM_COMMAND,
    cracking the params to get the ctrl ID
    idControl = GET_WM_COMMAND_ID ( wParam, lParam) ;
    in an edit look for the edit notification msgs ie EN_CHANGE ect (the text changed)
    Last edited by novacain; 08-25-2003 at 02:38 AM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> print into an edit box.

    Use SetWindowText() to write into an edit box and GetWindowText() to retrieve the contents.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    8
    Use SetWindowText() to write into an edit box and GetWindowText() to retrieve the contents.
    In more detail:

    SetWindowText(hEdit, "text");

    Replace hEdit with your own if you want.

    GetWindowText(hEdit, text, 5);

    The function gets the text from hEdit and stores it in text. Declare char in the following way:

    char text[5];

    Replace 5 with more if you want to use more characters in the character array.

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    if you want to get ALL the text in the window you could use:
    Code:
    GetWindowText(hEdit, text, GetWindowTextLength (hedit) + 1);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WS_HSCROLL in ES_READONLY edit box error
    By Homunculus in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2006, 08:46 AM
  2. Edit box(es), and specialized onmouseover
    By Lurker in forum Windows Programming
    Replies: 7
    Last Post: 05-25-2003, 04:13 PM
  3. Edit Boxes
    By ColdFire in forum Windows Programming
    Replies: 2
    Last Post: 02-13-2002, 02:54 PM
  4. please help visual c++ edit control boxes
    By alcoholic in forum C++ Programming
    Replies: 3
    Last Post: 02-05-2002, 02:39 PM
  5. Password Edit Boxes
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2001, 02:40 PM