1. Add a Toolbar resource to ResourceView and name it IDR_TOOLBAR1.
2. Add the variable to the. h file of the main program:
CToolBar m_toolbar; CImageList img;
3. Add the following to the BEGIN_MESSAGE_MAP (CDetectorDlg, CDialog) function in the main program. h file:
On_policy_ex (TTN_NEEDTEXT, 0, OnToolTipText)
BOOL CDormDlg::OnToolTipText(UINT, NMHDR *pTTTStruct, LRESULT *pResult)
{
ASSERT(pTTTStruct->code == TTN_NEEDTEXTA || pTTTStruct->code == TTN_NEEDTEXTW);
TOOLTIPTEXTA *pTTA=(TOOLTIPTEXT*)pTTTStruct;
TOOLTIPTEXTW *pTTW=(TOOLTIPTEXTW*)pTTTStruct;
CString strTipText,strStatus;
UINT nID = pTTTStruct->idFrom;
(pTTTStruct->code == TTN_NEEDTEXTA &&(pTTA->uFlags & TTF_IDISHWND) ||
pTTTStruct->code ==TTN_NEEDTEXTW &&(pTTW->uFlags & TTF_IDISHWND))
{
nID = ::GetDlgCtrlID((HWND)nID);
}
(nID != 0)
{
strTipText.LoadString(nID);
strTipText = strTipText.Mid(strTipText.Find(_T(),0)+1);
_UNICODE
(pTTTStruct->code == TTN_NEEDTEXTA)
{
lstrcpyn(pTTA->szText,strTipText,(pTTA->szText));
m_bar.SetPaneText(0,pTTA->szText);
}
{
_mbstowcsz(pTTW->szText,strTipText,(pTTW->szText));
}
(pTTTStruct->code == TTN_NEEDTEXTA)
{
_wcstombsz(pTTA->szText,strTipText,(pTTA->szText)) ;
m_bar.SetPaneText(0,pTTA->szText);
}
{
lstrcpyn(pTTW->szText,strTipText,(pTTW->szText));
m_bar.SetPaneText(0,);
}
*pResult = 0;
::SetWindowPos(pTTTStruct->hwndFrom,HWND_TOP,0,0,0,0,SWP_NOACTIVATE |
SWP_NOSIZE |SWP_NOMOVE |SWP_NOOWNERZORDER);
;
}
;
}
6. In the String resource of ResourceView, set the ID of each button in the toolbar to the prompt information you want to display.
7,