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

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:

     m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
     m_pMainWnd->UpdateWindow();

Thanks for your help!
cedigerAsked:
Who is Participating?
 
PriyeshConnect With a Mentor Commented:
in the OnInitialUpdate in your FormView derived class, if there is a line ResizeParentToFit, comment it.
0
 
killerdollCommented:
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?
0
 
cedigerAuthor Commented:
Privesh, That is what I needed. Thank you!
0
All Courses

From novice to tech pro — start learning today.