How could I get the text from and edit box? Maybe put it into a string?
Printable View
How could I get the text from and edit box? Maybe put it into a string?
hEdit- The handle of the edit box.Code:GetWindowText(HWND hEdit, char* buff, int Num);
buff- text is stored here
Num- maximum number of characters to write to buff.
Thanks! :D Do I have to fill in NUM myself or does it automatically check how big it is?
BTW Errors:
Code:C:\Windows\Profiles\Steve\Desktop\C c++\Win32 Using Edit Box\attempt.cpp(28) : error C2062: type 'char' unexpected
C:\Windows\Profiles\Steve\Desktop\C c++\Win32 Using Edit Box\attempt.cpp(29) : error C2065: 'buff' : undeclared identifier
Try this...
Code:char buffer[100];
GetWindowText(hEdit, buffer, 100);
Thanks jake...works like a charm :D
You can't always use 100, if the users has typed more than 100 chars in the box you won't get them...
so be sure to first use GetWindowTextLength to know how much to grab.