- Extracting text from a Edit Control ?
- Posted by Gizmo on October 12th, 2003
hi
iv created my self a Edit Controle as followed
hwndTextBox =
CreateWindow("EDIT","temp",WS_CHILD|WS_VISIBLE|WS_ BORDER,100,50,200,100,hwnd
,NULL,GlobalHInstance,NULL);
and it works fine i can type stuff in it. my only prob is i do not know how
to extract the text.
iv also created a button and what im trying to do is that when some one
presses the button i can copy what ever is in the Edit Controle and do what
ever i want to do with it in the programing.
iv got my button working as well i just can't figure out how to get access
to what the user types in.
Any help would be grate
Thanks
Giz
- Posted by Tom Picot on October 12th, 2003
Hmm your question is pretty basic win32 programming, you should check out
the tutorial at www.winprog.net/tutorial.
As for your question:
To get the text of a control use GetWindowText(..), e.g
char buf[100];
GetWindowText(hwndTextBox,buf,100);
Since you want this to happen when someone presses a button, you need to do
something like this in your message loop:
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDBUTTON:
char buf[100];
GetWindowText(hwndTextBox,buf,100);
break;
}
break;
Tom.
"Gizmo" <scottamillard@hotmail.com> wrote in message
news:bma9n1$ddf$1@newsg3.svr.pol.co.uk...
- Posted by Scott McPhillips [MVP] on October 12th, 2003
Gizmo wrote:
Hello Gizmo,
char buf[BUFSIZE];
SendMessage(hwndTextBox, WM_GETTEXT, BUFSIZE, buf);
--
Scott McPhillips [VC++ MVP]
- Posted by Gizmo on October 12th, 2003
Just wanted to thank you both for the help and thanks for the web link . .
its a grate help
thank you
giz