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.
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.
You'll get WM_CHAR message
yes but how do i tell it came from the edit box, and how do i get the data?
>>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
>>> 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.
In more detail:Use SetWindowText() to write into an edit box and GetWindowText() to retrieve the contents.
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.
if you want to get ALL the text in the window you could use:
Code:GetWindowText(hEdit, text, GetWindowTextLength (hedit) + 1);