CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2001
    Location
    Bremen, Germany
    Posts
    314

    Is a minimized Window maximized or normal?

    Hi

    I'm looking for a generic solution to determine whether a currently minimized window will be restored to its normal position or will be restored maximized.

    GetWindowPlacement ShowCmd always returns SW_SHOWMINIMIZED.

    I want to prevent the need to handle WM_SYSCOMMAND commands SC_MINIMIZE, SC_RESTORE and SC_MAXIMIZE and save the last state on every change.

    Thanks for your ideas!

    Oliver.
    Last edited by Oliver Twesten; February 5th, 2004 at 10:08 AM.

  2. #2
    Join Date
    Oct 2003
    Location
    Romania
    Posts
    127
    Try GetWindowPlacement

  3. #3
    Join Date
    Dec 2001
    Location
    Bremen, Germany
    Posts
    314
    Originally posted by marsh_pottaye
    Try GetWindowPlacement
    may I quote myself...
    Originally posted by Oliver Twesten
    GetWindowPlacement ShowCmd always returns SW_SHOWMINIMIZED.
    But thanks anyway.

  4. #4
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Is a minimized Window maximized or normal?

    Originally posted by Oliver Twesten
    I want to prevent the need to handle WM_SYSCOMMAND commands SC_MINIMIZE, SC_RESTORE and SC_MAXIMIZE and save the last state on every change.
    Handling the system commands won't help anyway, as the window state may have changed by other means (e.g. programmatically). However, you could handle WM_SIZE and save the nType value to a member variable. When the window is minimized (nType == SIZE_MINIMIZED), you take the last saved state and remember it in a second variable - that's your previous state.

  5. #5
    Join Date
    Dec 2001
    Location
    Bremen, Germany
    Posts
    314

    Re: Re: Is a minimized Window maximized or normal?

    Hi gstercken

    Thanks for this idea. You're right that handling of SC_MAXIMIZE etc. is no good way to go - it is most obvious when maximizing the window by double-clicking on the title area instead of clicking the maximize button...

    In the meantime, I used a similar approach than yours, but I'm still not satisfied (although it works). I'm looking for a way to save the state of a window *without* handling any messages for that window.

    I can not believe this could be so "complicated". Every simple framewnd app should store the window position including maximization state independent of whether it is terminated in minimized state or not.

    I thought this state had to be stored in the window object, but it does not seem to?

    Oliver.

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