Help needed in setting the dimensions of the window, when clicked on restore?

Posted on 2005-05-02
Last Modified: 2013-11-20

I am working with SDI application in MFC. When I click on the restore button on the system menu of the MainFrame window, the window dimensions should be set to 2/3 the width and height of the screen resolutions.

Can anyone please suggest, where and how to handle this event?

Question by:osi-sys
    LVL 43

    Accepted Solution

    The OnSize member function is as follows
    OnSize( UINT nType, int cx, int cy );
    If nType is SIZE_RESTORED then the window has been resized.

    width and height of screen
    int iWidth = GetSystemMetrics(SM_CXFULLSCREEN);
    int iHeight = GetSystemMetrics(SM_CYFULLSCREEN);

    Now you can use SetWindowPos or Move Window to to place the window where you want and with what size you want

    Author Comment

    Thanks AndyAinscow, it's working now

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Move Files and Folder To Root - Centos 6 4 63
    Generic progress indicator 6 107
    haveThree challenge 22 89
    firstChar challenge 13 57
    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now