Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie application title question

Status
Not open for further replies.

Jastper

Programmer
Oct 4, 2002
13
0
0
GB
Can someone tell me how to give my application a title. i.e the text displayed in the horizontal bar at the top of my application window next to the MFC image?
 
That horizontal bar at the top of your application window would be the 'title bar'.....

You can use CWnd::SetWindowText for that.

- You can do this from inside the CMainFrame classe like so: SetWindowText("Your app title").

- Your CWinApp derived class has a memeber variable called 'm_pMainWnd', which is a pointer to the main window. So from within that class you could do m_pMainWnd->SetWindowText("Your app title").

- Or from anywhere else in the application you could do: AfxGetMainWnd()->SetWindowText("Your app title").


Be careful though:
I don't know what kind of app you're writing, but if it supports the document/view architecture you'll find that when creating a new document, the document class privides you with a title, i.e. something like this "Untitled - Something". If this is the case, you will have to call SetWindowText after the creation of the new document.

Greetings,
Rick
 
If you are using the ClassWizard to do this, it's even easier than what LazyMe said. If it is dialog based, just bring up the dialog, right click, click Properties, and change the caption. If it is SDI or MDI, change the first element in your String Table. It should have a bunch of \n characters with some text in between some of them. Enter whatever you want your title to be before the first \n.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top