Generally,
SDI
The title of the main window is
:"
Document title
-
Main Window title
"
.
See
Winfrm. cpp
Code:
Void cframewnd: onupdateframetitle (bool
Baddtotitle)
{
...
Updateframetitlefordocument (pdocument-> gettitle ());
...
}
Void cframewnd: updateframetitlefordocument (lpctstr
Lpszdocname)
{
Cstring windowtext;
If (getstyle () & fws_prefixtitle)
{
//
Get name of currently active View
Windowtext + = lpszdocname + _ T ("-") + m_strtitle;
}
Else
{
Windowtext + = m_strtitle + _ T ("-") + lpszdocname;
}
Afxsetwindowtext (m_hwnd, (lpctstr)
Windowtext );
}
We can see that
,
The
Title
Is composed of the document block name and the title of the main window. Modifying the document title or the title of the main window can affect the final result.
You can modify the main window in the following ways:
Title
Method:
Method 1: document title change
Cdocument: settitle ()
For example
Onnewdocument ()
You can use
Settitle ()
Modify document title
Method 2: Change the title of the Main Window
The title of the main window is the project file name by default.
2.1
Exploitation
Resourceview
Open project resources and modify
String table
In
Idr_mainframe
Value
2.2
In
Cmainframe: precreatewindow ()
Modify
Cmainframe: m_strtitle
The preceding method can only modify the main window.
Title
Does not completely change the Main Window
Title
Form
Method 3:
Cxxxapp: initinstance ()
Direct Modification
Main Window
Title
M_pmainwnd-> setwindowtext (_ T ("
Main Window
Title "));
M_pmainwnd-> updatewindow ();
This method can completely modify the main window.
Title
, But once
Updatewindow
, Main Window
Title
It will be set back.
Method 4: Improve and modify method 2
M_strtitle
And later
Ws_overlappedwindow
Bool
Cmainframe: precreatewindow (createstruct & CS)
{
M_strtitle = _ T ("
Main Window
Title"
);
CS. Style = ws_overlappedwindow;
}
This ensures the Main Window
Title
Always unchanged.
Method 5: Process
Wm_settext
Message
This is the ultimate solution. If you want to dynamically set the main window
Title
Only this method is used.
More ........
Http://www.360watcher.net/html/60-5/5230.htm