class CToolBarCtrlDlg : public CDialog
{
// Construction
public:
CToolBarCtrlDlg(CWnd* pParent = NULL); // standard constructor
CToolBarCtrl m_Bar;
// Dialog Data
//{{AFX_DATA(CToolBarCtrlDlg)
enum { IDD = IDD_TOOLBARCTRL_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
..
// Generated message map functions
//{{AFX_MSG(CToolBarCtrlDlg)
..
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
// <
afx_msg void OnFirst();
afx_msg void OnSecond();
// >
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CToolBarCtrlDlg, CDialog)
//{{AFX_MSG_MAP(CToolBarCtrlDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
// <
ON_COMMAND(IDM_FIRST, OnFirst)
ON_COMMAND(IDM_SECOND, OnSecond)
..
// >
END_MESSAGE_MAP()
..
BOOL CToolBarCtrlDlg::OnInitDialog()
{
..
SetIcon(m_hIcon, FALSE); // Set small icon
m_Bar.Create(WS_BORDER|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|
CCS_TOP|CCS_ADJUSTABLE, CRect(50,50,50,50), this, ID_TOOLBAR);
VERIFY(m_Bar.AddBitmap(9, IDB_TOOLBAR) != -1);
TBBUTTON TBButton;
TBButton.fsStyle = TBSTYLE_BUTTON;
TBButton.fsState = TBSTATE_ENABLED;
VERIFY((TBButton.iString = m_Bar.AddStrings("..\0")) != -1);
TBButton.iBitmap = 0;
TBButton.idCommand = IDM_NEW;
TBButton.dwData = 0;
VERIFY(m_Bar.AddButtons(1,&TBButton));
TBButton.idCommand = 0;
TBButton.fsStyle = TBSTYLE_SEP;
TBButton.fsState = TBSTATE_ENABLED;
TBButton.iString = 0;
TBButton.iBitmap = 0;
TBButton.dwData = 0;
VERIFY(m_Bar.AddButtons(1,&TBButton));
..
m_Bar.AutoSize();
return TRUE;
}
..
void CToolBarCtrlDlg::OnFirst()
{
// TODO: Add your command handler code here
..
}
void CToolBarCtrlDlg::OnSecond()
{
// TODO: Add your command handler code here
..
}
..