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 show, but when I run a second time, the toolbars are the same 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):

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

Correct:

void 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: 10/16/2016 11:53 AM ()