Solved

maximizing windows in document view architecture

Posted on 2001-06-12
3
253 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now