-
window text
might sound stupid, but i am having problems writing a function that will change the text of a window, and return the previous text..the function is a member of my window class..so i know the handle from there
PHP Code:
char *set_text (char *text)
i dont know the size of the current text..i figured a way to do it using the new operator..but then i return the value and i cant use delete after return..
thanks
-
Use the STL string =).
Z.
-
ok..i am gonna do it that way then..thanks a lot
-
Or this way (if it's pure C):
int set_text(const char *new_text, char *old_text, int old_size);
The user passes the size of the buffer in old_size. If it's too small the function returns error.
If old_text == NULL and new_text == NULL the function returns the size needed. If old_text == NULL but new_text != NULL the function doesn't return the old text.
-
thats actually quite ingenious..thanks CornedBee
-
CornedBee, i have to compare GetWindowTextLength to old_size right?
-
Yes, that's the idea. And if both old_text and new_text are NULL, you return GetWindowTextLength()
-