?
Solved

Default MFC Window Size

Posted on 1998-10-21
2
Medium Priority
?
541 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 200 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

771 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