avatar  


Recently viewed tickets

Log out

I create two toolbars in the OnCreate method of my CMainFrame class. When I run the application for the first time, the toolbars appear, but when I run it again, they appear identical and look like the second toolbar. What am I doing wrong?

Make sure that each toolbar is created with its own unique id:

Wrong (each toolbar was created with AFX_IDW_TOOLBAR ID):

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    ....
    m_wndToolBar.Create(this, <style>);
    m_wndToolBar2.Create(this, <style>);
    ....
}


Correct:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    ....
    m_wndToolBar.Create(this, <style>);
    m_wndToolBar2.Create(this, <style>, id_of_second_toolbar);
    ....
}
Creation date: 10/16/2016 11:53 AM ()      Updated: 12/4/2024 9:02 PM (support)