stopping MDI Child from maximizing
Mike Marshall -- marshall@milner.com Monday, December 02, 1996 Environment: VC++ 4.2b, Win 95, NT 4.0 I've run into a problem and I've been banging on it for about a week now. The problem is this: A standard MDI application created with the AppWizard in VC++ behaves as follows: If two or more MDI Children exist, pressing CTRL-TAB will move to the next MDI child window. There is a special case that goes along with this. If the current MDI child is maximized, and you hit CTRL-TAB, the next MDI child will not only be activated, but also maximized automatically. I want to step in and make it so that the next MDI child stays in its normal state, i.e., I don't want it to be maximized when it is activated after hitting Ctrl-TAB. I've tried the following: 1. Overriding ActivateFrame for my MDI child window class. Result: this doesn't get called when you hit Ctrl-TAB. 2. Overriding OnSysCommand for my MDI child window class and stopping any SC_MAXIMIZE's. Result: This only gets called when you hit the maximize button or choose Maximize from the window's system menu. I've tried a number of different things with functions like OnWindowPosChanging, but to no avail. What I want to avoid most is having the min/max/close buttons placed at the far right side of the menu like a maximized window. I've tried FAQ, MSDN, mfc-l archives and newsgroups to no avail as well. any ideas? -- Mike Marshall Com Squared Systems marshall@comsquared.com
Dean Wiles -- deanw@isc-br.isc-br.com Wednesday, December 04, 1996 [Mini-digest: 4 responses] Try overriding CMyChildFrame::OnMDIActivate, save the state (min/max/normal) when child is deactivated, and do the appropriate MDIRestore or MDIMaximize when activated. However, I vaguely remember some MDI bugs when making MDI calls while MDI is swapping windows, so test it well before you call it done. FYI, I think when you switch from a maximized MDI child, MDI will restore the current window and maximize the new window. -------------------------------------------------------------------------- Dean Wiles (deanw@mail.isc-br.com) Olivetti North America Phone: (509)927-7037 22425 East Appleway Ave Fax: (509)927-2499 Liberty Lake, WA 99019-9534 If the Son sets you free, you will be free indeed. (John 8:36) ---------- > From: Mike Marshall> To: 'mfc-l@netcom.com' > Subject: stopping MDI Child from maximizing > Date: Monday, December 02, 1996 2:19 PM > > Environment: VC++ 4.2b, Win 95, NT 4.0 > > I've run into a problem and I've been banging on it for about > a week now. The problem is this: > > A standard MDI application created with the AppWizard in > VC++ behaves as follows: > > If two or more MDI Children exist, pressing CTRL-TAB will > move to the next MDI child window. There is a special case > that goes along with this. If the current MDI child is > maximized, and you hit CTRL-TAB, the next MDI child will not > only be activated, but also maximized automatically. > > I want to step in and make it so that the next MDI child > stays in its normal state, i.e., I don't want it to be > maximized when it is activated after hitting Ctrl-TAB. > > I've tried the following: > > 1. Overriding ActivateFrame for my MDI child window class. > Result: this doesn't get called when you hit Ctrl-TAB. > > 2. Overriding OnSysCommand for my MDI child window class > and stopping any SC_MAXIMIZE's. > Result: This only gets called when you hit the maximize > button or choose Maximize from the window's system menu. > > I've tried a number of different things with functions like > OnWindowPosChanging, but to no avail. > > What I want to avoid most is having the min/max/close buttons > placed at the far right side of the menu like a maximized > window. > > I've tried FAQ, MSDN, mfc-l archives and newsgroups to no avail as > well. > > any ideas? > -- > Mike Marshall > Com Squared Systems > marshall@comsquared.com > -----From: Mike Marshall I've tried OnMDIActivate to no avail as well. But funny you should reply, because I think I just cracked the nut. In my MDI Child's OnWindowPosChanging, I added SWP_NOREDRAW and SWP_NOMOVE to the flags member of the structure and it worked. I am having problems with the main window caption not updating properly, but that's a small problem. This worked for me, but the particular MDI child window I am dealing with is positioned off the screen (i.e. with negative coordinates), so if anybody else is going to try this i'm not really sure what the window would look like if you make the above change. My goal was to KEEP it off the screen, and not pop back into the picture after CTRL-TAB. (yes, this is part of an egregious hack, so don't ask =) Thanks, Mike ---------- From: Andrew Lazarus[SMTP:DrLaz@advisorsw.com] Sent: Wednesday, December 04, 1996 8:43 AM To: Mike Marshall Subject: Re: stopping MDI Child from maximizing I'm just guessing frmo memory, but can you do something useful in CMdiFrame::OnMDIActivate ? Also, does GetMinMaxInfo get called with Ctrl-Tab in this situation? andrew lazarus senior software engineer DrLaz@advisorsw.com -----From: David Lowndes > I want to step in and make it so that the next MDI child stays in its normal state, i.e., I don't want it to be maximized when it is activated after hitting Ctrl-TAB. < Mike, Do any of the following Knowledge Base articles help? Q71669 - "Preventing an MDI Child Window from Changing Size"Q99411 PRB: Processing the WM_QUERYOPEN Message in an MDI Application -----From: Antonio Anciaes Overwrite the PreCreateWindow for the frame window. For example: BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style &=3D ~WS_MAXIMIZEBOX & // Do not want a Max. box ~WS_MINIMIZEBOX & // Do not want a Min. box ~WS_THICKFRAME; // Do not want to resize return CMDIChildWnd::PreCreateWindow(cs); } A.Anci=E3es ---------- From: Mike Marshall[SMTP:marshall@milner.com] Sent: segunda-feira, 2 de dezembro de 1996 22:19 To: 'mfc-l@netcom.com' Subject: stopping MDI Child from maximizing Environment: VC++ 4.2b, Win 95, NT 4.0 I've run into a problem and I've been banging on it for about a week now. The problem is this: A standard MDI application created with the AppWizard in VC++ behaves as follows: If two or more MDI Children exist, pressing CTRL-TAB will move to the next MDI child window. There is a special case that goes along with this. If the current MDI child is maximized, and you hit CTRL-TAB, the next MDI child will not only be activated, but also maximized automatically. I want to step in and make it so that the next MDI child stays in its normal state, i.e., I don't want it to be maximized when it is activated after hitting Ctrl-TAB. I've tried the following: 1. Overriding ActivateFrame for my MDI child window class. Result: this doesn't get called when you hit Ctrl-TAB. 2. Overriding OnSysCommand for my MDI child window class and stopping any SC_MAXIMIZE's. Result: This only gets called when you hit the maximize button or choose Maximize from the window's system menu. I've tried a number of different things with functions like OnWindowPosChanging, but to no avail. What I want to avoid most is having the min/max/close buttons placed at the far right side of the menu like a maximized window. I've tried FAQ, MSDN, mfc-l archives and newsgroups to no avail as well. any ideas? -- Mike Marshall Com Squared Systems marshall@comsquared.com
| Вернуться в корень Архива |