不用MFC 做基於對話框的程序,不像書上的 SDK 例子一樣在窗体中一個一個創建控件,用一個對話框資源創建窗体在 win32 Application 工程中要怎麼樣實現 ???我以下的做法對不對? 對的話要接著做什麼?怎麼做?(我在編譯時已經出錯了)A
新建一個 win32 Application 選擇 “A Sample Win32 Application”工程
B
然後 insert / resource 加入一個 Dialog / FormView資源. 保存些資源文件,把這個資源文件加入到工程中.
C
View / ClassWizard 新建一個 .clw 文件 然后在新建一個類 Base Class 為 Cdialog 類 DialogID 為先前建的FormView資源的 ID
有一個繼承自CWinApp的類的全局對像.
並在InitInstance里
CDlgPreprintDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
} // Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}