導航:首頁 > 版本升級 > 文件對話框創建步驟

文件對話框創建步驟

發布時間:2024-01-22 11:37:27

① MFC如何在單文檔中添加對話框

首先新建一個對話框資源,初始化程序實例是由InitInstance函數完成的。因此彈出這個對話框的代碼也是放在這個函數里的。
代碼如下:
BOOL CDlgTestApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to rece the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CLogsys TestDlg;
if(TestDlg.DoModal()==IDOK) // 單擊Ok後就開始初始化程序實例
{
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CDlgTestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CDlgTestView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
else // 假如單擊了CANCEL按鈕就直接退出
return FALSE;
}
當然不是單擊OK就可以進入單文檔視圖,在單擊OK後還要進行檢查用戶名和密碼。因此要在對話框的OnOK函數里添加相應的處理代碼。
void CLogsys::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE); // 獲取輸入數據
if(m_strUser=="Admin"&&m_strPwd=="1234")
{
CDialog::OnOK(); // 假如用戶名和密碼正確,就關閉對話框
}
/*假如用戶名或密碼錯誤,且還未超出登陸次數,就進行提示*/
if((m_strUser!="Admin"||m_strPwd!="1234")&&(m_Time<3)) //假如密碼和用戶名正確
{
AfxMessageBox("用戶名或密碼不正確");
m_Time++;
}
/*假如超出登陸次數,提示並退出系統*/
if(m_Time>2)
{
AfxMessageBox("登陸錯誤次數超過3次");
PostQuitMessage(0);
}
}
當然在實際中功能還應進行擴充,比如3次登陸失敗後就應限制這台電腦在一定時間內不能登陸等,還有比如如何驗證多個用戶名進行登陸等等。

② 電腦桌面怎麼新建文件

1、我們先來來創建一個新自建文件夾。在桌面空白處點擊滑鼠右鍵,會出現一個窗口,點擊新建。
2、這時會出現另一個窗口,在彈出的窗口裡選擇文件夾。
3、
這時會看到桌面上出現了一個新建文件夾,這就是我們剛才創建的文件夾,我們的目標是把零亂的圖標全部收進這個文件夾里。

③ 如何在Word中加一個對話框

在Word中加一個對話框的具體步驟如下:

需要准備的材料分別是:電腦、Word文檔。

1、首先打開需要編輯的Word文檔,進入到編輯頁面中。

閱讀全文

與文件對話框創建步驟相關的資料

熱點內容
紅頭文件訂書紅線在哪裡 瀏覽:851
excel怎麼做文件頭 瀏覽:703
為什麼word找不到文件菜單 瀏覽:671
ios15安裝後找不到描述文件 瀏覽:440
學編程怎麼學最有效 瀏覽:873
通過wifi傳文件到ipad 瀏覽:197
js隨機顏色 瀏覽:611
文件快速復制到u盤的軟體 瀏覽:443
如何檢查無線網路驅動是否正常 瀏覽:468
百度網盤來自分享的文件在哪裡 瀏覽:127
如何發視頻到騰訊視頻文件夾里 瀏覽:510
微信打開cad外部文件找不到 瀏覽:882
平板可以打開各種文件後綴的軟體 瀏覽:531
蘋果微信文件怎麼全選 瀏覽:749
手機里之前打開過的文件在哪裡找 瀏覽:685
cad能看word文件嗎 瀏覽:719
12306火車票系統後台資料庫 瀏覽:570
js翻譯德語 瀏覽:33
從哪裡可以下載a股的數據 瀏覽:437
邏輯文件名和物理文件名關系 瀏覽:66

友情鏈接