|
-
Jul 19th, 2001, 05:53 PM
#1
Thread Starter
PowerPoster
Adding two values!
I want to set my window's titlebar text to "the name of my program" and the opened file name:
Here are the variables:
char chosenfile[MAX_PATH];
That variable contains the name of the file opened.
Now I want to set the window's text to:
SetWindowText(hwnd, "Notepad" + chosenfile);
but that method does not work. What is the way to add two string and then set the text to that string?
-
Jul 19th, 2001, 06:38 PM
#2
transcendental analytic
string concentration
strcat ("Notepad",&chosenfile)
should do it, i think.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 19th, 2001, 06:48 PM
#3
Monday Morning Lunatic
No. A literal string is always const char*. The string class is about as easy as it gets:
Code:
SetWindowText(hWnd, (string("Notepad - ") + pcFileName).c_str());
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 19th, 2001, 07:00 PM
#4
transcendental analytic
oh ok, i wont argue
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 19th, 2001, 07:34 PM
#5
Thread Starter
PowerPoster
But how do I set the text. That code does not work because I have the variable "chosenfile" instead of "pcFileName". And also it gives me error message saying that "string" is not declared even I include the header "<string.h>" OR ""string.h"" OR ""string""
-
Jul 19th, 2001, 07:35 PM
#6
Monday Morning Lunatic
Code:
#include <string>
using std::string;
Just use chosenfile then
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|