+// ---------------------------------------------------------------------------
+// misc
+// ---------------------------------------------------------------------------
+
+void wxMDIChildFrame::MSWDestroyWindow()
+{
+ MSWDetachWindowMenu();
+ invalidHandle = GetHwnd();
+
+ wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+
+ // Must make sure this handle is invalidated (set to NULL) since all sorts
+ // of things could happen after the child client is destroyed, but before
+ // the wxFrame is destroyed.
+
+ HWND oldHandle = (HWND)GetHWND();
+ SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY,
+ (WPARAM)oldHandle, 0);
+ invalidHandle = 0;
+
+ if (m_hMenu)
+ {
+ ::DestroyMenu((HMENU) m_hMenu);
+ m_hMenu = 0;
+ }
+ m_hWnd = 0;
+}
+
+// Change the client window's extended style so we don't get a client edge
+// style when a child is maximised (a double border looks silly.)
+bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
+{
+#if defined(__WIN95__)
+ RECT *rect = (RECT *)vrect;
+ wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
+ wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
+ if (!pChild || (pChild == this))
+ {
+ DWORD dwStyle = ::GetWindowLong(GetWinHwnd(pFrameWnd->GetClientWindow()), GWL_EXSTYLE);
+ DWORD dwThisStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
+ DWORD dwNewStyle = dwStyle;
+ if (pChild != NULL && (dwThisStyle & WS_MAXIMIZE))
+ dwNewStyle &= ~(WS_EX_CLIENTEDGE);
+ else
+ dwNewStyle |= WS_EX_CLIENTEDGE;
+
+ if (dwStyle != dwNewStyle)
+ {
+ HWND hwnd = GetWinHwnd(pFrameWnd->GetClientWindow());
+ ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, dwNewStyle);
+ ::SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOACTIVATE |
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+ SWP_NOCOPYBITS);
+ if (rect)
+ ::GetClientRect(hwnd, rect);
+
+ return TRUE;
+ }
+ }
+#endif // Win95
+
+ return FALSE;
+}
+
+// ===========================================================================
+// wxMDIClientWindow: the window of predefined (by Windows) class which
+// contains the child frames
+// ===========================================================================
+