Window Size Changes when I open a file(File->Open)

Posted on 2003-03-20
Medium Priority
Last Modified: 2013-11-20
I have an SDI application, where the view class is derieved from CFormView.  On startup, I maximize the window, but when I open a file (CWinApp::OnFileOpen), the window returns to the size specified in the resource file.  I would like for the window to remain the same size as before the File Open (Maximized or not).  Any ideas?

This code is in the InitInstance() function of the CWinApp derived class to maximize the window:


Thanks for your help!
Question by:cediger
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

Expert Comment

ID: 8178775
Maybe you can specify in your Mainframe how large you'd like it to be, then it won't change its size later on.

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
     if( !CFrameWnd::PreCreateWindow(cs) )
          return FALSE;

    cs.cy = ::GetSystemMetrics(SM_CYSCREEN);
    cs.cx = ::GetSystemMetrics(SM_CXSCREEN);
    cs.y = 0;
    cs.x = 0;

     return TRUE;

It is not the maximizing effect though...(it just get the screen size and set the application size = screen size) Would it serve your purpose?

Accepted Solution

Priyesh earned 200 total points
ID: 8178952
in the OnInitialUpdate in your FormView derived class, if there is a line ResizeParentToFit, comment it.

Author Comment

ID: 8180550
Privesh, That is what I needed. Thank you!

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

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…

762 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