SetTitle in MainFrm.cpp - Programmer
This is a discussion on SetTitle in MainFrm.cpp - Programmer ; Hi,
I have to change SDI window caption. I tried:
GetDocument()->SetTitle("aaa") ;
but this code is in CMainFrame method, so I can't access view class.
Thanks for any help.
Deli...
-
SetTitle in MainFrm.cpp
Hi,
I have to change SDI window caption. I tried:
GetDocument()->SetTitle("aaa") ;
but this code is in CMainFrame method, so I can't access view class.
Thanks for any help.
Deli
-
Re: SetTitle in MainFrm.cpp
"Deli" wrote in message news:...
> Hi,
> I have to change SDI window caption. I tried:
>
> GetDocument()->SetTitle("aaa") ;
>
> but this code is in CMainFrame method, so I can't access view class.
> Thanks for any help.
>
You can get a pointer to the document from the mainframe by using
GetActiveDocument().
HTH
Paul.
-
Re: SetTitle in MainFrm.cpp
> You can get a pointer to the document from the mainframe by using
> GetActiveDocument().
>
> HTH
Thanks, it works! 
But I can only change the begin of caption: "title" in "title - AppName",
how to change the whole caption?
TIA!
Deli
-
Re: SetTitle in MainFrm.cpp
Have you tried something like:
AfxGetMainWindow()->SetWindowText(...); ?
--
-------------------------------------------------------------------------
Free software - Baxter Codeworks www.baxcode.com
-------------------------------------------------------------------------
"Deli" wrote in message
news:ccjogb$1s5$1@news.onet.pl...
> > You can get a pointer to the document from the mainframe by using
> > GetActiveDocument().
> >
> > HTH
>
> Thanks, it works! 
> But I can only change the begin of caption: "title" in "title - AppName",
> how to change the whole caption?
> TIA!
>
> Deli
>
-
Re: SetTitle in MainFrm.cpp
Deli wrote:
>>You can get a pointer to the document from the mainframe by using
>>GetActiveDocument().
>>
>>HTH
>
>
> Thanks, it works! 
> But I can only change the begin of caption: "title" in "title - AppName",
> how to change the whole caption?
> TIA!
>
> Deli
>
To disable the MFC automatic window title stuff do this:
// MFC override to tweak window style during creation
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~FWS_ADDTOTITLE; // kill cutesy MFC titles
return CFrameWnd::PreCreateWindow(cs);
}
Then you can use SetWindowText to control the entire title
--
Scott McPhillips [VC++ MVP]