All functions return TRUE but Dlg is not seen. :( May be matter is my dialog is modeless? If I surely not forgot anything? I just added toolbar itself, toolbar member (public)
class CMainDlg : public CDialog
{
DECLARE_DYNAMIC(CMainDlg)
public:
CToolBar tb;
...
}
and that lines in OnInitDialog:
BOOL CMainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(tb.Create(this))
{
if( tb.LoadToolBar(IDR_TOOLBAR1) ){
tb.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
tb.ShowWindow(SW_SHOW); // <--- here goes
}
}
I made no handlers but tb must already be seen at this stage IMHO? PS Your code works for me. I begun aproach your code to mine and revealed next thing. After commenting line m_wndFormatBar.SetWindowPlacement(&wpl); in your code your toolbar disappearing too. So write just
m_wndFormatBar.Create(this); // attach command routing to dialog window
m_wndFormatBar.LoadToolBar(IDR_TOOLBAR_FORMAT);
m_wndFormatBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndFormatBar.ShowWindow(SW_SHOW);
is not enough to show toolbar. At least at mine comp. I will investigate it on. And thanks for example. -- modified at 6:00 Friday 14th April, 2006