Display help for dialog controls on the status bar
Posted
by Nikolay Sokratov
on August 7th, 1998
1. Create function to handle WM_SETCURSOR
BOOL CAboutDlg::OnSetCursor(CWnd * pWnd, UINT nHitText, UINT message)
{
// if the cursor is not over a child window control, revert
// to the default status bar text
if(pWnd == this)
SetPaneText();
else
SetPaneText(pWnd->GetDlgCtrlID());
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
2. Handle WM_DESTROY message to restore status bar text
void CAboutDlg::OnDestroy()
{
SetPaneText();
CDialog::OnDestroy();
}
3. Add SetPaneText helper function
// this part goes to CAboutDlg class declaration
protected:
void SetPaneText(UINT nID = 0);
// and this is function implementation
void CAboutDlg::SetPaneText(UINT nID)
{
if(nID == 0)
nID = AFX_IDS_IDLEMESSAGE;
CWnd * pWnd = AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR);
if(pWnd)
{
AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, nID);
pWnd->SendMessage(WM_IDLEUPDATECMDUI);
pWnd->UpdateWindow();
}
}
4. And finally do not foget to add following include files
#include// for WM_SETMESSAGESTRING and WM_IDLEUPDATECMDUI #include // for AFX_IDW_STATUS_BAR
Last updated: 11 May 1998

Comments
How about menu items
Posted by Legacy on 10/31/2000 12:00amOriginally posted by: Jeff Nygren
This was just what I needed for displaying help text for my controls. I want to do the same thing for popup menu items. How can I detect when the user passes the mouse over the items in a popup menu?
ReplyMissing includefiles on screen...
Posted by Legacy on 11/20/1998 12:00amOriginally posted by: Albert van Peppen
Reply