这是官方原文: Q: 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? A: Be 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); .... }
HKEY_CURRENT_USER\Software\BCG AppWizard-Generated Applications下的东西删除了
http://www.codeproject.com/docking/toolbar_docking.asp
显示3个toolbar的时候,第一次运行3个toolbar没有横向排列在第一行上面,而是一行一个toolbar。关掉程序第二次运行的时候,又在同一行了。
感觉多个toolbar的排列有问题。能不能指定放在同一行上或者不同行上?
第一个toolbar用CreateEx建立
第二个toolbar用Create建立
要不然,清理注册表是没用的,
想当初为这个郁闷死了,该死的BCG
每个toolbar 得ID都是AFX_IDW_TOOLBAR
void CMainFrame::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
....
m_wndToolBar.Create (this, <style>);
m_wndToolBar2.Create (this, <style>);
....
} 正确代码:
void CMainFrame::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
....
m_wndToolBar.Create (this, <style>);
m_wndToolBar2.Create (this, <style>, AFX_IDW_TOOLBAR +100);//ID不一样
....
}
Q: 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?
A: Be 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);
....
}
http://www.bcgsoft.com/faq.htm#Q10