This solution applies only when your report windows are derived from CFrameWnd.
The basic window title of
CFrameWnd
and
CDocument
classes is stored in the member variable
m_strTitle
which can be set and retrieved with the virtual functions
SetTitle()
and
GetTitle()
. So you should use
SetTitle()
to change the title or overwrite the function. Note that this will only change the member variable. You must still call
SetWindowText()
. The member variable is initialized by
Create()
with the window name passed to
Create()
.
If not using
SetTitle()
, the on screen title will be updated using the m_
strTitle
text.
Another point that must be observed is the automatic creation of frame windows.
CFrameWnd
windows created by document templates have the implicit style
FWS_ADDTOTITLE
. When this style is set, the title is updated each time when an internal idle flag is set. To remove the flag, overwrite
PreCreateWindow()
of your frame window class:
BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~FWS_ADDTOTITLE;
return CFrameWnd::PreCreateWindow(cs);
}