Link to home
Start Free TrialLog in
Avatar of jd9288
jd9288

asked on

How to catch status bar click event

I need to minimize the program on status bar click event in MFC.
How do I do that?
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jd9288
jd9288

ASKER

Actually, this doesn't work. Or, rather, it works if you click on ANY button or drop-down list, not just on
the status bar. Any ideas?
Try this:

BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
  if (pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_wndStatusBar.m_hWnd)
    ActivateFrame(SW_MINIMIZE);
     
  return CMDIFrameWnd::PreTranslateMessage(pMsg);
}

Good Luck,
Steve