Click to See Complete Forum and Search --> : Maximize in CFormView


Bill Wright
June 4th, 1999, 07:59 AM
When you create an SDI project using CFormView as the view class the following behavior occurs: Start the application; maximize the window with the maximize icon in the upper right corner of the frame; open a file. When you do this, the application window resizes to the original size but the resize icon still shows the 'double window' maximize icon. To get the window back to maximum, it is necessary to click that icon twice - once to unmaximize and then once to remaximize. This all happens without any modifications to the wizard generated project. If you modify the call to ShowWindow in the application's InitInstance to SW_SHOWMAXIMIZED, the same behavior occurs. BTW, this behavior does not occur using the normal CView in as SDI application. Please email any ideas/solutions to wwright@cardinalsolutions.com Thanks

Laurent Bernard
June 4th, 1999, 08:21 AM
I don't understand exactly your problem, but the best way to maximize a frame or a view at the initialization is to redefine the style in the PreCreateWindow() like that:

BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= WS_MAXIMIZE;
return CMDIChildWnd::PreCreateWindow(cs);
}

good luck !


---------------------------------------------
Laurent BERNARD
Ingénieur Développement - Logiciel Visilog

NOESIS
6, rue de la réunion
91940 Les Ulis

E-mail : lb@noesis.fr
------------------------------------------------

chris law
June 4th, 1999, 08:22 AM
The most easiest way to start with a maximized form view is to register your own WndClass with WS_Maximized style, modify the CreateStruct to use your WndClass instead of standard window class. I did not test it against your special problems, but I do not remember to have encountered any of them...

hope this helps

chrislaw

chris law
June 4th, 1999, 08:24 AM
I may be wrong but I thought this does not work for Form Views?

chrislaw

Bill Wright
June 4th, 1999, 08:32 AM
Actually, what is happening is a bug in a project created by AppWizard using SDI with CFormView. I don't want the window to be permanently maximized - I want it to be at the option of the user. The problem is that when a file is opened, the window is resized but the icon still indicates that it is maximized. I suspect that some member data which saves the size is not getting set properly and when the window is redrawn, the incorrect size is being used.

chris law
June 4th, 1999, 08:40 AM
with the method I proposed the window would still be resizable by user, other problems I have to try whether solved, but as you pointed out it may not be the solution.
(I did not intend to put the bug on your shoulders ;-)

chrislaw