|
許多未解決的問題,先放一放,抽時(shí)間解決。 (1)增加Dialog資源 (2)為新的Dialog分配一個(gè)新類名(對(duì)資源窗口“右鍵”->“添加類”) (3)在主對(duì)話框上加一個(gè)include "新類名dialog.h" 大氣象
//顯示模態(tài) newDialog newDlg; newDlg.DoModal(); //得到對(duì)話框中控件的值,未實(shí)現(xiàn),再研究。 CEdit *cEdit = (CEdit*) newDlg.GetDlgItem(IDC_EDIT1); CString txtStr; cEdit->GetWindowText(txtStr); MessageBox(txtStr); //非模態(tài) CDialog *dlg = new CDialog; dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOWNA); //非模態(tài),只顯示單個(gè)窗口,不能多個(gè) if (dlg->IsWindowEnabled() == FALSE)//這里出錯(cuò)了,不知何故。 { dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOWNA); } else { MessageBox(_T("已存在")); dlg->ShowWindow(SW_SHOWNA); } //隱藏對(duì)話框 this->ShowWindow(SW_HIDE); Sleep(3000); this->ShowWindow(SW_SHOW); //關(guān)閉/銷毀對(duì)話框 this->DestroyWindow(); this->EndDialog(0); //最小化窗口 this->CloseWindow(); |
|
|