在对话框类定义中:CToolBar m_wndtoolbar;
在OnInitDialog()中:
if (!m_wndtoolbar.CreateEx( this,TBSTYLE_FLAT,  WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS ,
CRect(4,4,0,0)) || !m_wndtoolbar.LoadToolBar(IDR_TOOLBAR1))
{
TRACE0("failed to create toolbar\n");
return FALSE;
}
m_wndtoolbar.ShowWindow(SW_SHOW);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
可是程序根本无法运行,DBUG时发现在运行到BOOL CFilesApp::InitInstance()中的
m_pMainWnd = &dlg;时弹出如题的错误。
这个程序在加工具条前可以正常运行
希望大家帮忙!谢谢!