Solved

maximizing windows in document view architecture

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

631 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