How to create toolbar on the dialog.

 
0
 

I have created a toolbar in mfc. I want to add this toolbar on my dialog. So in the dialog's OnInitDialog() function I am trying to create this toolbar. But the toolbar is not coming. Please tell me how can create it.

BOOL CDlgsViewDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CToolBar toolBar;
        CRect	rcClientOld; // Old Client Rect
	CRect	rcClientNew; // New Client Rect with Tollbar Added
	GetClientRect(rcClientOld); // Retrive the Old Client WindowSize
	toolBar.Create(this);
	toolBar.LoadToolBar(IDR_MAINFRAME);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0,reposQuery,rcClientNew);
	return TRUE;  // return TRUE  unless you set the focus to a control
}
You
Post:
Start New Discussion
Tags Related to this Article