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
Any help is much appreciated,
Jared
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.
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
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 : ).
ASKER
>> 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.
>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?
ASKER
To Triskelion:
Absolutely nothing.
Absolutely nothing.
USE MDIRESTORE FUNCTION INSIDE THE MDICHILDWND DERIVED CLASS
YOU SHOULD BE ABLE TO GET WHAT YOU WANT
YOU SHOULD BE ABLE TO GET WHAT YOU WANT
ASKER
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Where did you use it?