CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Posts
    515

    restoring the last state of app like in ShowWindow()

    When my application exits, I want to see if its final state is maximized or minimized or etc so I can restore it to that state when it is restarted again. I don't see any function which can tell me that (sort of the opposition function of ShowWindow())

    In MFC it is easy to set the application to maximized:
    Code:
    m_nCmdShow = SW_MAXIMIZE;
    but I would rather like to set it to the last state. Any hints? Thanks.

  2. #2
    Join Date
    May 2000
    Location
    Washington DC, USA
    Posts
    715

    Re: restoring the last state of app like in ShowWindow()

    what you want to do is handle the WM_SIZE messages specifically wehre the type is (MAXIMIZE,MINIMIZE,RESTORE) and track what state your program is yourself.

    When you exit you store it to the registry, when you come up you load it from the registry.

  3. #3
    Join Date
    Aug 2006
    Posts
    515

    Re: restoring the last state of app like in ShowWindow()

    Quote Originally Posted by JMS
    what you want to do is handle the WM_SIZE messages specifically wehre the type is (MAXIMIZE,MINIMIZE,RESTORE) and track what state your program is yourself.

    When you exit you store it to the registry, when you come up you load it from the registry.
    Can the state be not captured elsewhere other than WM_SIZE?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: restoring the last state of app like in ShowWindow()

    Take a look at this thread
    Victor Nijegorodov

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