View Full Version : Getting Edit Box Value

02-27-2004, 03:45 PM
How do you get the value of an edit box in C++?

02-28-2004, 02:26 PM
Well assuming that you are using the Windows API ( which I think you were off to start learning last time ) there are 2 ( maybe more ) ways..

Method 1 -- Use GetWindowText() -- I think this works!

int length = GetWindowTextLength( hwnd ) + 1;
char buffer[ length ];
GetWindowText( hwnd, buffer, length );

the variable buffer now contains the text of the window....maybe ;)..

Method 2-- The more correct way is to use the EM_GETLINE message--

char *buffer = (char*)SendMessage( hwnd, EM_GETLINE, (WPARAM)1, (LPARAM)0 );

I'm pretty sure that those methods both work..

03-03-2004, 03:33 PM
thx again :thumbsup: