Solved

Default MFC Window Size

Posted on 1998-10-21
2
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

724 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