Solved

maximizing windows in document view architecture

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

15 Experts available now in Live!

Get 1:1 Help Now