许多未解决的问题,先放一放,抽时间解决。 (1)增加Dialog资源 (2)为新的Dialog分配一个新类名(对资源窗口“右键”->“添加类”) (3)在主对话框上加一个include "新类名dialog.h" 大气象
//显示模态 newDialog newDlg; newDlg.DoModal(); //得到对话框中控件的值,未实现,再研究。 CEdit *cEdit = (CEdit*) newDlg.GetDlgItem(IDC_EDIT1); CString txtStr; cEdit->GetWindowText(txtStr); MessageBox(txtStr); //非模态 CDialog *dlg = new CDialog; dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOWNA); //非模态,只显示单个窗口,不能多个 if (dlg->IsWindowEnabled() == FALSE)//这里出错了,不知何故。 { dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOWNA); } else { MessageBox(_T("已存在")); dlg->ShowWindow(SW_SHOWNA); } //隐藏对话框 this->ShowWindow(SW_HIDE); Sleep(3000); this->ShowWindow(SW_SHOW); //关闭/销毁对话框 this->DestroyWindow(); this->EndDialog(0); //最小化窗口 this->CloseWindow(); |
|