另外关于CreateDialog,作一点补充,和本题无关,权当增加dfw资料库.. :D
1.调用CreateDialog实际上是调用了CreateDialogParam,它作了什么呢,大致如此:
HWND CreateDialogParam(HINSTANCE hinst, LPCSTR lpTemplateName, HWND hwndOwner,
DLGPROC pfnDlgProc, LPARAM lParamInit)
{
// Find the dialog box template resource in the EXE file.
HRSRC hrsrc = FindResource(hinst, lpTemplateName, RT_DIALOG);
HGLOBAL hglblRes = LoadResource(hinst, hrsrc);
// Obtain the memory address of the dialog box template.
PDLGTEMPLATEEX pDlgTemplate = (PDLGTEMPLATEEX) LockResource(hglblRes);
// Create the parent window and child windows using the
// template contained in the memory block.
HWND hwndDlg = CreateDialogIndirectParam(hinst, pDlgTemplate, hwndOwner, pfnDlgProc, lParamInit);
// NOTE: Windows NTdo
es not require that resources be unlocked or freed;
// however, Windows 95do
es have this requirement. It is always safer to
// clean up than to leak memory for your process.
UnlockResource(pDlgTemplate);
FreeResource(hglblRes);
// Return the handle of the parent window.
return(hwndDlg);
}
2.而CreateDialogIndirectParam的动作,应该就是分析内存块,为每个窗口(包括控件)调用
CreateWindowEx,所以,CreateDialog和CreateWindowEx区别应该不大,只要是更方便 ..
3.详见《Windows 95 程式设计指南》 http://www.2ccc.com/article.asp?articleid=2063