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

文件對話框創建步驟

發布時間: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文檔,進入到編輯頁面中。

閱讀全文

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

熱點內容
linux設置共享文件 瀏覽:392
新型網路資源人們如何利用他們 瀏覽:415
桌面的系統文件被刪除 瀏覽:718
java三次方 瀏覽:23
編程貓核桃編程學而思編程哪個好 瀏覽:592
cad怎樣新建文件命名 瀏覽:758
word2010參考文獻交叉引用 瀏覽:480
幻燈片文件名怎麼改 瀏覽:576
哪個網站買手機當天到貨 瀏覽:740
小孩編程入門軟體有哪些 瀏覽:265
數據如何服務於客戶 瀏覽:687
求個那種微信號 瀏覽:602
linux文件加鎖 瀏覽:526
學英語和編程哪個好 瀏覽:390
ios攔截電話代碼 瀏覽:311
酷狗音樂60老版本 瀏覽:515
編程怎麼樣刪除鑲件 瀏覽:40
手機打開隱藏文件也找不到的文件 瀏覽:136
大數據如何運用到工作實效中 瀏覽:996
車載凱立德導航升級多少錢 瀏覽:974

友情鏈接