I am trying to create a toolbar on my dialog, so I am creating it in the OnInitDialog() function, but the toolbar is not coming. please help me finding whats going wrong in this. Thanks Sujan

BOOL CDlgsViewDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CToolBar m_FirstToolBar;
	if(!m_FirstToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | 
	WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | 
	CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 
	!m_FirstToolBar.LoadToolBar(IDR_MAINFRAME))
{
   EndDialog(IDCANCEL);
}

RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

I dont recognize the datatype "CToolBar"... is this libraries added to C++?

CToolBar is the class for the toolbar. Anyway my problem is sorted out, I need to declare it a member variable then it works. thanks for your efforts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.