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):
Correct:
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);
....
}