In a dialog based application I've added a toolbar.

Member variable: CToolBar m_wndToolBar;


BOOL CTestDlg::OnInitDialog()
{
...

m_wndToolBar.Create(this);
m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
m_wndToolBar.ShowWindow(SW_SHOW);
m_wndToolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_FLOATING);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

...
}

then using class wizard i've added two functions for each button:

void CTestDlg::OnButton1()
{
.....
}

void CTestDlg::OnUpdateButton1(CCmdUI* pCmdUI)
{
.....
}

There is no problem to invoke OnButton1() while pressing Button1.
What should I add to code to invoke OnUpdateButton1(CCmdUI* pCmdUI)???

Thanks in advance.