Click to See Complete Forum and Search --> : Minimized Window


May 8th, 1999, 05:07 PM
Is there a way to trap a application being minimized (WM_MINIMIZED???)?
Thanks!

Dan Haddix
May 8th, 1999, 07:44 PM
You need to overload the OnSysCommand handler in your window class. However since the WM_SYSCOMMAND is not an option in class wizard so you'll need to add it by hand.

First add

afx_msg void OnSysCommand( UINT nID, LPARAM lParam );

before the DECLARE_MESSAGE_MAP() call in your class definition

then add

ON_WM_SYSCOMMAND()

between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP in the classes .cpp file

then add the OnSysCommand() handler to the. cpp file like so...

void CMainFrame::OnSysCommand( UINT nID, LPARAM lParam ){
if (nID == SC_MINIMIZE){
// Process minimize message here
}
else
CFrameWnd::OnSysCommand(nID, lParam);
}

Good Luck!!!