Solved

maximizing windows in document view architecture

Posted on 2001-06-12
3
257 Views
Last Modified: 2013-11-20
hi everybody,
    i have started a project using mfc and msaccess. in mfc i use document view architecture. i have 3 forms each having a set class, a view class,and a doc class. have attached each forms doctemplate using new CMultiDocTemplate
IDR_MENU,
RUNTIME_CLASS(DOC)
RUNTIME_CLASS(CChildFrame)
RUNTIME_CLASS(view)
for each form.
and open it using OpenDocumentFile Command Of CMultiDocumentTemplate class. the childwindow opens but only in normal mode please help me to open the window in MAXIMIZED MODE. and also i need to disable all the maximize minimize buttons .

faithfully
anoop




0
Comment
Question by:anoopsukumar
[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
3 Comments
 
LVL 5

Expert Comment

by:ekc
ID: 6183078
OpenDocumentFile() opens the document logicaly. The physical layer (the window apparience) of this operation is managed in the CWnd class, as the base window class.
If you want your child wnd always to appear maximized, the best solution is to override its PreCreateWindow() function and add this part of the code before the call to the base class version of the function...

     LONG     dwSt;

        // Get the current window styla
     dwSt = ::GetWindowLong( this->m_hWnd, GWL_STYLE );

        // Maximize it!
     dwSt = dwSt | WS_MAXIMIZE;

        // Save the new style.
     ::SetWindowLong( this->m_hWnd, GWL_STYLE, dwSt );

        // Update the window with the new style.
     ::SetWindowPos( this->m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED );


This way, your child windows will always be borned maximized. If you want to control this behaviour, you can move this piece of code to some wnd's function and call it any time you wish.
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 50 total points
ID: 6184335
Hi,

U want the child windows to be maximised as soon as they come up? Then just map OnInitialUpdate() function to ur view class and modify it as bellow.

void CMyView::OnInitialUpdate()
{
     CFormView::OnInitialUpdate();
     GetParent()->ShowWindow(SW_SHOWMAXIMIZED);
}

That should give u the maximised child window. Try it out.
VinExpert
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9484647
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : VinExpert

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 108
no14 challenge 14 77
isEverywhere  challenge 19 91
Use of condition with 'serial' in ansible 2 102
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.

739 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