Link to home
Start Free TrialLog in
Avatar of jaredg27
jaredg27

asked on

Minimizing a window

I am using (modeless) CFormView windows, all with CMDIChildWnd frames.  Some of them have locked sizes.  Due to the sizes being locked I do not want them to be able to maximize (that just looks really weird).  In addition, if a maximized window calls one of these locked size windows, I want the locked size window to open restored (not maximized like Windows wants).  I have tried using ShowWindow(SW_RESTORE) from both the view and the frame.  It appears as if nothing happens when the command is processed.  When I try using SW_MINIMIZE in place of SW_RESTORE the window minimizes.  Why is it that SW_RESTORE doesn't work?  Am I using it in the wrong place?  Any suggestions or other recommendations?
Any help is much appreciated,

Jared
Avatar of nil_dib
nil_dib

>> Am I using it in the wrong place?
Where did you use it?
CWnd has a member function
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );

define this virtual function to provide the max_min info.
i think this is the best solution.


Keep me updated
Avatar of jaredg27

ASKER

I wish that would work, but responding to WM_GETMINMAXINFO in the frame is how I got this problem!  I mean, I already have the window locked at a particular size there by setting the maximum and minimum dimensions.  I don't want the window to display maximized with those dimensions; it just looks really weird.  So I need to actually restore the window, not just choose a particular size.  Thanks for the help though : ).
>> Am I using it in the wrong place?
>Where did you use it?

I tried using it in both the view and the frame
>>I have tried using ShowWindow(SW_RESTORE)
>>from both the view and the frame.
What happens if you issue the ShowWindow(SW_RESTORE) twice in a row?
To Triskelion:
Absolutely nothing.
USE MDIRESTORE FUNCTION INSIDE THE MDICHILDWND DERIVED CLASS
YOU SHOULD BE ABLE TO GET WHAT YOU WANT
Jaguar_sri:

It seems like you are definitely heading me in the right path.  Unfortunately, I could not get it to restore the window from the places I tried it (the view's OnSize and OnInitialUpdate).  (I used a pointer to the frame.)  The function works in other places (like responding to a button click).  Where would I want the function to reside so that the window could never be maximized (so that if it opened it always opens restored)?  Is there anything more I would need to handle that situation?
ASKER CERTIFIED SOLUTION
Avatar of speedup
speedup

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  ~WS_MAXMIZEBOX was one thing I needed.  What I also realized this morning was that I merely had to restore the window that was calling the child window before i opened it.  That easily worked.