Solved

Default MFC Window Size

Posted on 1998-10-21
2
527 Views
Last Modified: 2013-11-20
I'm developing a version of Pente using MFC for a programming class and have created a representation of the board.  However, the board doesn't fall within the bounds of the default window created when I open the application.  I began the program using the AppWizard.  How do I change the default size of the application window?
0
Comment
Question by:Mephisto
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
jrmcg earned 50 total points
ID: 1323683
If this is an SDI or MDI application you can use the

CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.x = iXNum     // x-coordinate of upper-left corner of main window
    cs.y = iYNum    // y-coordinate of upper-left corner of main window
    cs.cx = iWNum // width of window
    cs.cy = iHNum  // height of window

    return CMDIFrameWnd::PreCreateWindow(cs);  // this is added with the wizard
}

You can add the PreCreateWindow override through the class wizard by selecting the application's MainFrame class and selecting PreCreateWindow from the messages.

I am assuming this is not a dialog application, because you should be able to just size the dialog at design time to suit your needs.  If this is not what you need let me know.

J.R.
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1323684
AND --
If your display is inside a document of an  MDI then just override the PreCreateWindow of the frame class of that document using the same method.

J.R.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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