PDA

Click to See Complete Forum and Search --> : Get Problems


DiEDa
Feb 4th, 2001, 09:55 AM
How to use GetWindowText, GetWindowTextLength, GetDlgItem.

Feb 4th, 2001, 12:15 PM
**
HWND hwnd;
int len;
char * text;

hwnd = GetDlgItem(hwnd_of_parent_dialog_box, ID_OF_THE_ITEM);
len = GetWindowTextLength(hwnd) + 1;
text = new char[len];
GetWindowText(hwnd, text, len);

Jop
Feb 4th, 2001, 02:44 PM
I don't know Dennis, but shouldn't you use delete after new?


HWND hwnd;
int len;
char * text;

hwnd = GetDlgItem(hwnd_of_parent_dialog_box, ID_OF_THE_ITEM);
len = GetWindowTextLength(hwnd) + 1;
text = new char[len];
GetWindowText(hwnd, text, len);
delete [] text;


not sure, so I want to know ;)

parksie
Feb 4th, 2001, 03:01 PM
Yes, but only once you've finished with it :rolleyes:. Anyway, all allocated memory is returned to the system when your program exits :)

...but that's no substitute for clearing up ;)

Jop -- technically you're correct
Dennis -- couldn't be bothered
Parksie -- shut up, you're rambling incessantly