CDialog的用法
//继承CDialog实现一个自己的对话框 class CMyDialog:CDialog { public: CMyDialog(UINT uIDTemplate = IDD, CWnd* pParent = NULL); ~CMyDialog(); {IDD = IDD_MYDIALOG} MyCreate(); } CMyDialog::CMyDialog(UINT uIDTemplate, CWnd* pParent) :CDialog(uIDTemplate, pParent) { } CMyDialog::MyCreate() { Create(IDD, GetParent()); //注意这里GetParent将返回一个空的句柄,从而导致父窗口是Application的顶级窗口 } CMyDialog myDlg = new CMyDialog(IDD, pParent); myDlg->MyCreate();