// ChildFrm.cpp : implementation of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "MDITestView.h"
#include "ChildFrm.h"
void CChildFrame::OnFinalMessage(HWND /*hWnd*/)
{
delete this;
}
HWND CChildFrame::CreateEx(HWND hWndParent, _U_RECT rect /*= NULL*/, LPCTSTR szWindowName /*= NULL*/, DWORD dwStyle /*= 0*/, DWORD dwExStyle /*= 0*/, LPVOID lpCreateParam /*= NULL*/)
{
HWND hWnd=NULL;
BOOL bMaximizeNewChild = (WS_MAXIMIZE == (GetWndStyle(dwStyle) & WS_MAXIMIZE));
//Yanxm 2007��9��25�� 14:03:59
hWnd = baseClass::CreateEx(hWndParent, rect, szWindowName, dwStyle, dwExStyle, lpCreateParam);
if(bMaximizeNewChild == FALSE)
{
// If WS_MAXIMIZE wasn't requested, check if the currently
// active MDI child (if there is one) is maximized. If so,
// maximize the new child window to match.
::SendMessage(hWndParent, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximizeNewChild);
}
if(bMaximizeNewChild == TRUE)
{
::SendMessage(hWndParent, WM_SETREDRAW, FALSE, 0);
// We'll ShowWindow(SW_SHOWMAXIMIZED) instead of using
// WS_MAXIMIZE (which would cause visual anomolies in some cases)
dwStyle = (GetWndStyle(dwStyle) & ~WS_MAXIMIZE);
}
//:~Yanxm 2007��9��25�� 14:03:59
{
//Yanxm 2007��9��25�� 14:03:59
if(bMaximizeNewChild == TRUE)
{
if(hWnd)
::ShowWindow(hWnd, SW_SHOWMAXIMIZED);
::SendMessage(hWndParent, WM_SETREDRAW, TRUE, 0);
::RedrawWindow(hWndParent, NULL, NULL,
//A little more forceful if necessary: RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
RDW_INVALIDATE | RDW_ALLCHILDREN);
}
if(hWnd != NULL && ::IsWindow(m_hWnd) && !::IsChild(hWnd, ::GetFocus()))
::SetFocus(hWnd);
//:~Yanxm 2007��9��25�� 14:03:59
if(hWnd){
::SetWindowLong(hWnd,GWL_USERDATA,(LONG)this);
UpdateClientEdge();
}
}
return hWnd;
}
LRESULT CChildFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
#ifdef _USE_DLL
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
#else
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
#endif
bHandled = FALSE;
return 1;
}
LRESULT CChildFrame::OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LPMSG pMsg = (LPMSG)lParam;
if(baseClass::PreTranslateMessage(pMsg))
return TRUE;
return m_view.PreTranslateMessage(pMsg);
}