MDI приложение на MFC (не создается клиентское окно)
Вот код:
class CMainFrame:public CMDIFrameWnd
{
public:
CMainFrame();
virtual ~CMainFrame();
protected:
afx_msg int OnCreate(LPCREATESTRUCT cs);
afx_msg void OnSize( UINT nType, int cx, int cy );
afx_msg void OnPaint();
afx_msg void OnDestroy();
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
CMenu MainMenu;
DECLARE_MESSAGE_MAP()
};
CMainFrame::CMainFrame()
{
MainMenu.LoadMenu(IDR_MAIN_MENU);
}
BEGIN_MESSAGE_MAP(CMainFrame,CMDIFrameWnd)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_PAINT()
ON_WM_DESTROY()
END_MESSAGE_MAP()
CMainFrame::~CMainFrame()
{
}
afx_msg int CMainFrame::OnCreate(LPCREATESTRUCT cs)
{
CreateClient(cs,&MainMenu);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs)
{
cs.hMenu = MainMenu.m_hMenu;
cs.lpszName = "Hello";
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0);
return CMDIFrameWnd::PreCreateWindow(cs);
}
void CMainFrame::OnSize(UINT nType, int cx,int cy)
{
CMDIFrameWnd::OnSize(nType, cx, cy);
RecalcLayout();
}
void CMainFrame::OnPaint()
{
CRect WinRect;
GetClientRect(&WinRect);
ValidateRect(&WinRect);
}
void CMainFrame::OnDestroy()
{
}