//在另一个窗口中创建时
CTestDlg *pDlg = new CTestDlg();
pDlg->Create(IDD_DIALOG_TEST,this);
pDlg->ShowWindow(TREU):
在自己类中销毁
void CTestDlg::OnNcDestroy()
{
DestroyWindow();
CDialogEx::OnNcDestroy();
}
void CTestDlg::PostNcDestroy()
{
CDialogEx::PostNcDestroy();
delete this;
}