Holy cow, I wrote a book!
The first major chunk of the dialog manager has to do with reading the dialog template and creating a dialog box based on it.
All of the CreateDialogXxx functions are just front-ends to the real work that happens in CreateDialogIndirectParam. Some of them are already visible in the macros: CreateDialog is just a wrapper around CreateDialogParam, with a parameter of zero. Similarly, CreateDialogIndirect is just a wrapper around CreateDialogIndirectParam with a zero parameter.
Here's a slightly less trivial wrapper:
HWND WINAPI CreateDialogParam(HINSTANCE hinst, LPCTSTR pszTemplate, HWND hwndParent, DLGPROC lpDlgProc, LPARAM dwInitParam) { HWND hdlg = NULL; HRSRC hrsrc = FindResource(hinst, pszTemplate, RT_DIALOG); if (hrsrc) { HGLOBAL hglob = LoadResource(hinst, hrsrc); if (hglob) { LPVOID pTemplate = LockResource(hglob); // fixed 1pm if (pTemplate) { hdlg = CreateDialogIndirectParam(hinst, pTemplate, hwndParent, lpDlgProc, dwInitParam); } FreeResource(hglob); } } return hdlg; }
All CreateDialogParam does is use the hinst/pszTemplate to locate the lpTemplate, then use that template in CreateDialogIndirectParam.
Okay, this was easy. Tomorrow, we're going to create the dialog from the template.