|
-
Aug 31st, 2002, 11:03 AM
#1
Thread Starter
Hyperactive Member
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
Amon Ra
The Power of Learning.
-
Aug 31st, 2002, 12:17 PM
#2
Frenzied Member
Use the STL string =).
Z.
-
Aug 31st, 2002, 12:39 PM
#3
Thread Starter
Hyperactive Member
ok..i am gonna do it that way then..thanks a lot
Amon Ra
The Power of Learning.
-
Sep 2nd, 2002, 05:39 AM
#4
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 2nd, 2002, 01:13 PM
#5
Thread Starter
Hyperactive Member
thats actually quite ingenious..thanks CornedBee
Amon Ra
The Power of Learning.
-
Sep 2nd, 2002, 05:09 PM
#6
Thread Starter
Hyperactive Member
CornedBee, i have to compare GetWindowTextLength to old_size right?
Amon Ra
The Power of Learning.
-
Sep 3rd, 2002, 03:36 AM
#7
Yes, that's the idea. And if both old_text and new_text are NULL, you return GetWindowTextLength()
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 4th, 2002, 07:42 PM
#8
Thread Starter
Hyperactive Member
Amon Ra
The Power of Learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|