How does VC dynamically obtain the toolbar pointer and add a title to the toolbar?

Source: Internet
Author: User

[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 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.