[Question]
The toolbar is also a window with a title. How can I add a title to the toolbar?
[ProgramImplementation]
You do not want to dynamically change the toolbar title in cmainframe: oncreate:
Int cmainframe: oncreate (maid)
{
......
M_wndtoolbar.setwindowtext (_ T ("standdard "));
Return 0;
}
To dynamically change the title of a toolbar, follow these steps:
Declare a menu and respond to events, such as the onmytoolbar () function.
Void cmainframe: onmytoolbar ()
{
// Todo: add your command handler code here
Ctoolbar * ptoolbar = (ctoolbar *) afxgetmainwnd ()-> getdescendantwindow (afx_idw_toolbar );
Ptoolbar-> setwindowtext (_ T ("standdard "));
}
Do not make onmytoolbar () errors when toobar is suspended.
By the way, how can we get the pointer of a status bar:
Cstatusbar * pstatusbar = (cstatusbar *) afxgetmainwnd ()-> getdescendantwindow (afx_idw_status_bar );