0

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
}
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by sujan.dasmahapa
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.