Changing Mainframe's title dynamically 
Author Message
 Changing Mainframe's title dynamically

Hi,

How can I set Mainframe's title dynamically? I can set it
when I start my application (see the following code) but
after that if I do something (e.g. open a view and then
close it) --> Mainframe's title is not the same than after
InitInstance(). How can I set the title the same as after
InitInstance()?

BOOL CMyApp::InitInstance()
{
.
.
.
        CString strTitle;

        if(nSomething != 0)
        {
                strTitle.LoadString(IDS_TITLE_XXX);
        }
        else
        {
                strTitle.LoadString(IDS_TITLE_YYY);
        }

        // Set title
        m_pMainWnd->SetWindowText(strTitle);

Quote:
}

TIA,

-HS



Mon, 10 Oct 2005 15:23:36 GMT  
 Changing Mainframe's title dynamically

Quote:
>How can I set Mainframe's title dynamically?

Eliminate the FWS_ADDTOTITLE style from the frame window in the
window's PreCreateWindow handler.

Have a look at Knowledge Base article 99182 "HOWTO: Change an
MFC-Based MDI Child Window's Frame Text" for an example.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Mon, 10 Oct 2005 17:06:02 GMT  
 Changing Mainframe's title dynamically
Dave,

Thank you for your answer but is it possible to do another
way (without eliminating FWS_ADDTOTITLE style)?

-HS

Quote:
>-----Original Message-----
>>How can I set Mainframe's title dynamically?

>Eliminate the FWS_ADDTOTITLE style from the frame window
in the
>window's PreCreateWindow handler.

>Have a look at Knowledge Base article 99182 "HOWTO:
Change an
>MFC-Based MDI Child Window's Frame Text" for an example.

>Dave
>--
>MVP VC++ FAQ: http://www.mvps.org/vcfaq
>.



Mon, 10 Oct 2005 17:43:27 GMT  
 Changing Mainframe's title dynamically
Another way is to override OnUpdateFrameTitle of your mainframe. In it you
should be able to call SetWindowText().

--
Ajay Kalra [MVP - VC++]


Quote:
> Dave,

> Thank you for your answer but is it possible to do another
> way (without eliminating FWS_ADDTOTITLE style)?

> -HS
> >-----Original Message-----
> >>How can I set Mainframe's title dynamically?

> >Eliminate the FWS_ADDTOTITLE style from the frame window
> in the
> >window's PreCreateWindow handler.

> >Have a look at Knowledge Base article 99182 "HOWTO:
> Change an
> >MFC-Based MDI Child Window's Frame Text" for an example.

> >Dave
> >--
> >MVP VC++ FAQ: http://www.mvps.org/vcfaq
> >.



Mon, 10 Oct 2005 22:47:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Can I change window's title color dynamically?(no content)

2. Changing Title for Mainframe Window

3. MainFrame Title change

4. How to change title in mainframe

5. How do I Change mainframe title?

6. Want to change Title of MainFrame

7. dynamically changing MDI MainFrame menu

8. How to change DialogBox title text dynamically

9. Change title for dialog box dynamically

10. change title for dialog box dynamically

11. Dynamically changing PropertyPage Title

12. Dynamically change a COlePropertyPage title

 

 
Powered by phpBB® Forum Software