• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 916
  • Last Modified:

HOWTO change titlebar from a SDI application?

Hello!

HOWTO can I the change titlebar from my SDI MFC application?
Currently it is doc/view with default title:
"filename - appname"
I want to change to:
"appname - filename"

thanks!
0
jussara
Asked:
jussara
1 Solution
 
migelCommented:
Hi!
override in the your CMainFrame:
virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
code can be like this:

{
     // copy first part of title loaded at time of frame creation
     TCHAR szText[256+_MAX_PATH] ;
     *szText = 0;

     CDocument* pDocument = GetActiveDocument();
     if (bAddToTitle && pDocument != NULL)
          {
           lstrcpy(szText, pDocument->GetTitle());
          lstrcat(szText, _T(" - "));
          }
     lstrcat(szText, m_strTitle);
     AfxSetWindowText(m_hWnd, szText);
}
0
 
shambhu_421Commented:
hi,
you question seams to be interesting . could you kindly explain your question in detail.

thanks,
sham.
0
 
jussaraAuthor Commented:
I must change AfxSetWindowText(m_hWnd, szText);
to
SetWindowText(szText);
to work well.

Thanks
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now