CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Minimized Window

    Is there a way to trap a application being minimized (WM_MINIMIZED???)?
    Thanks!


  2. #2
    Join Date
    May 1999
    Posts
    82

    Re: Minimized Window

    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!!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured