void CFrameWnd::UpdateFrameTitleForDocument(LPCTSTR lpszDocName)
{
CString WindowText;
if
(GetStyle() & FWS_PREFIXTITLE)
{
//
get name of currently active view
if
(lpszDocName != NULL)
{
WindowText += lpszDocName;
//
add current window
if
(m_nWindow > 0)
{
TCHAR szText[32];
//
:%d will produce a maximum of 11 TCHARs
wsprintf(szText, _T(
":%d"
), m_nWindow);
WindowText += szText;
}
WindowText += _T(
" - "
);
}
WindowText += m_strTitle;
}
else
{
//
get name of currently active view
WindowText += m_strTitle;
if
(lpszDocName != NULL)
{
WindowText += _T(
" - "
);
WindowText += lpszDocName;
//
add current window
if
(m_nWindow > 0)
{
TCHAR szText[32];
//
:%d will produce a maximum of 11 TCHARs
wsprintf(szText, _T(
":%d"
), m_nWindow);
WindowText += szText;
}
}
}
//
set
title
if
changed, but don't remove completely
//
Note: will be excessive
for
MDI Frame with maximized child
AfxSetWindowText(m_hWnd, (LPCTSTR) WindowText);
}