// DlgTop.cpp : 实现文件
//

#include "stdafx.h"
#include "NetSDKDemo.h"
#include "DlgTop.h"


// CDlgTop 对话框

IMPLEMENT_DYNAMIC(CDlgTop, CDialog)

CDlgTop::CDlgTop(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgTop::IDD, pParent)
{
	m_pMenuDlg = NULL;
}

CDlgTop::~CDlgTop()
{
}

void CDlgTop::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CDlgTop, CDialog)
	ON_WM_CLOSE()
	ON_WM_CREATE()
END_MESSAGE_MAP()


// CDlgTop 消息处理程序

BOOL CDlgTop::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void CDlgTop::OnClose()
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	SAFE_DELETE(m_pMenuDlg);
	CDialog::OnClose();
}

void CDlgTop::SetViewWnd(TopWndID emWndID, int nCmdShow)
{	
	switch (emWndID)
	{
	case MENU_DLG:
		if(m_pMenuDlg) m_pMenuDlg->ShowWindow(nCmdShow);
		break;
	}
}

void CDlgTop::CreateSubWnd()
{
	// center
	CRect rcClient;
	GetClientRect(&rcClient);
	m_pMenuDlg = new CMenuDlg(this);
	m_pMenuDlg->Create(CMenuDlg::IDD, NULL);
	m_pMenuDlg->SetWindowPos(NULL,
		rcClient.left,
		rcClient.top,
		rcClient.Width(),
		rcClient.Height(),
		SWP_SHOWWINDOW);
}

int CDlgTop::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码

	return 0;
}
