Perhaps this article from the Microsoft Developer Network may help
(I strongly recommend it since it could've saved you time and
given you some good answers).
This is one of many articles:
INF: How to Change an MFC-Based MDI Child Window's Frame Text
PSS ID Number: Q99182
Article last modified on 04-01-1994
2.00 2.10 2.50
WINDOWS
----------------------------------------------------------------------
The information in this article applies to:
- Microsoft Foundation Classes for Windows, versions 2.0 and 2.5
- Microsoft Foundation Classes for Windows NT, version 2.1
----------------------------------------------------------------------
SUMMARY
=======
A user may find it desirable to change the title of an MFC-based
child
window. To do this, PreCreateWindow() must be overridden for the
child
frame, and OnInitialUpdate() must be overridden for the view.
MORE INFORMATION
================
These are the steps necessary to change the title of a multiple
document interface (MDI) child window frame. When doing this, follow
the rules of "The Windows Interface: An Application Design Guide" for
child frame titles, which states the following:
...a document window title bar should contain a caption that
displays the name of the document in the window.
Add your customized information in addition to that.
1. Create an MDI application from AppWizard.
2. Using Class Wizard, create a new class based on CMDIChildWnd.
3. Choose Project. Scan All Dependencies.
4. Choose the project's main .CPP file and replace the CMDIChildWnd
class in the call to the AddDocTemplate() function to the new
class you created.
5. Include the newly created .H file at the top of the project's main
.CPP file.
6. Choose the .H file from the project list for the newly created
class and add the following line to the protected implementation
section:
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
7. Choose the .CPP file from the project list for the newly created
class and add the following to the end of the file
BOOL CMyChildFrame::PreCreateWindow(CREATESTRUCT &cs)
{
// Do default processing.
if(CMDIChildWnd::PreCreateWindow(cs)==0) return FALSE;
return TRUE;
}
where CMyChildFrame is the class name of your newly created class.
This function calls the base class's version for the
OnUpdateFrameTitle() function.
8. Add the following code line to the newly created PreCreateWindow()
function immediately following the default call to
CMDIChildWnd::PreCreateWindow():
cs.style&=~(LONG)FWS_ADDTOTITLE;
9. Choose the .H file corresponding to your application's view window
and add the following code to the public implementation section:
virtual void OnInitialUpdate();
10. Choose the .CPP file corresponding to your application's view
window and add the following code to the end of the file
void CMyAppView::OnInitialUpdate()
{
// Do default processing.
CView::OnInitialUpdate();
}
where CMyAppView is the view class for the application.
11. Add your customization code. Remember to follow the rules of
"The Windows Interface: An Application Design Guide" for child
frame titles. Then add your customized information, in addition to
that, immediately following the default call to
CView::OnInitialUpdate(). An example of this is:
GetParent()->SetWindowText(GetDocument()->GetTitle()+
" - This is a test!");
12. Build the program.
13. Run it and you will see the change implemented. In this example,
the first view will display "Myapp1 - this is a test!". Additional
views will be identical except for the document name (Myapp1).
NOTE: It is necessary to override OnInitialUpdate instead of OnCreate
because the document has not been instantiated, and therefore calling
GetTitle() would return an empty string.
Additional reference words: 2.00 2.50
KBCategory: Prg
KBSubcategory:
=============================================================================
Copyright Microsoft Corporation 1994.
Charles Steinhardt[MVP]