-
May 24th, 2005, 06:16 AM
#1
Changing an application title
Hi - Im programming a Doc-View project, and couldnt find how to change the application title from "XXXXX - Untitled" to just "XXXXX"
Can anyone assist ?
Thanks
Timor
-
May 24th, 2005, 06:17 AM
#2
Re: Changing an application title
Look at ::SetWindowText ( ) api.
Cheers
Shahar
-
May 24th, 2005, 06:28 AM
#3
Re: Changing an application title
No I am almost sure SetWindowText would not work, use SetTitle in Document class initialization instead.
Regards
Ashwin
-
May 24th, 2005, 07:03 AM
#4
Re: Changing an application title
I think it is XXXXX – Untitled for SDI application.
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~FWS_ADDTOTITLE;
return TRUE;
}
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
May 24th, 2005, 07:54 AM
#5
Re: Changing an application title
Originally Posted by AshwinRao
No I am almost sure SetWindowText would not work
Yes, it works...
-
May 24th, 2005, 08:02 AM
#6
Re: Changing an application title
Please tell me how and where you got it working. Try to paste a snippet with the function and the class where you got it working. And moreover I was speaking renaming the Child Windows, the poster has not specified what is to be renamed.
Regards
Ashwin
Last edited by AshwinRao; May 24th, 2005 at 08:05 AM.
-
May 24th, 2005, 08:05 AM
#7
Re: Changing an application title
To clarify:
It will work only for SDI application it will not work for MDI application since title of the main frame window is updated when active child window changes.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
May 24th, 2005, 09:42 AM
#8
Re: Changing an application title
Originally Posted by AshwinRao
Please tell me how and where you got it working. Try to paste a snippet with the function and the class where you got it working. And moreover I was speaking renaming the Child Windows, the poster has not specified what is to be renamed.
He said:
couldnt find how to change the application title
To me that means main frame's text, which, as John explained, is changed each time the active child window changes.
That doesn't mean you can't change it, if only temporary with SetWindowText().
Code:
AfxGetMainWnd()->SetWindowText("bla bla bla");
anywhere you want, as long as the call is made from the GUI thread (so that AfxGetMainWnd returns a pointer to the main window).
However, this will change when a new child window becomes active.
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
|