Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

maximizing windows in document view architecture

Posted on 2001-06-12
3
Medium Priority
?
262 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:
Vinayak Kumbar earned 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

824 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