{"id":36043,"date":"2005-03-29T07:04:00","date_gmt":"2005-03-29T07:04:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/03\/29\/the-dialog-manager-part-1-warm-ups\/"},"modified":"2005-03-29T07:04:00","modified_gmt":"2005-03-29T07:04:00","slug":"the-dialog-manager-part-1-warm-ups","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050329-00\/?p=36043","title":{"rendered":"The dialog manager, part 1: Warm-ups"},"content":{"rendered":"<p>I think a lot of confusion about the dialog manager\nstems from not really understanding how it works.\nIt&#8217;s really not that bad.  I&#8217;ll start by describing how\ndialog boxes are created over the next few articles,\nthen move on to the dialog message loop, and wrap up\nwith some topics regarding navigation.\nThere will be nine parts in all.<\/p>\n<p>\nThe first major chunk of the dialog manager has to do\nwith reading the dialog template and creating a dialog box\nbased on it.\n<\/p>\n<p>\nAll of the CreateDialogXxx functions are just front-ends\nto the real work that happens in\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/DialogBoxes\/DialogBoxReference\/DialogBoxFunctions\/CreateDialogIndirectParam.asp\">\nCreateDialogIndirectParam<\/a>.\nSome of them are already visible in the macros:\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/winui\/windowsuserinterface\/windowing\/dialogboxes\/dialogboxreference\/dialogboxfunctions\/createdialog.asp\">\nCreateDialog<\/a> is just a wrapper around\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/DialogBoxes\/DialogBoxReference\/DialogBoxFunctions\/CreateDialogParam.asp\">\nCreateDialogParam<\/a>,\nwith a parameter of zero.\nSimilarly,\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/DialogBoxes\/DialogBoxReference\/DialogBoxFunctions\/CreateDialogIndirect.asp\">\nCreateDialogIndirect<\/a> is just a wrapper around\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/DialogBoxes\/DialogBoxReference\/DialogBoxFunctions\/CreateDialogIndirectParam.asp\">\nCreateDialogIndirectParam<\/a> with a zero parameter.\n<\/p>\n<p>\nHere&#8217;s a slightly less trivial wrapper:\n<\/p>\n<pre>\nHWND WINAPI CreateDialogParam(HINSTANCE hinst,\n    LPCTSTR pszTemplate, HWND hwndParent,\n    DLGPROC lpDlgProc, LPARAM dwInitParam)\n{\n  HWND hdlg = NULL;\n  HRSRC hrsrc = FindResource(hinst, pszTemplate,\n                             RT_DIALOG);\n  if (hrsrc) {\n    HGLOBAL hglob = LoadResource(hinst, hrsrc);\n    if (hglob) {\n      LPVOID pTemplate = LockResource(hglob); \/\/ fixed 1pm\n      if (pTemplate) {\n        hdlg = CreateDialogIndirectParam(hinst,\n                 pTemplate, hwndParent, lpDlgProc,\n                 dwInitParam);\n      }\n      FreeResource(hglob);\n    }\n  }\n  return hdlg;\n}\n<\/pre>\n<p>\nAll CreateDialogParam does is use the\nhinst\/pszTemplate to locate the lpTemplate,\nthen use that template in CreateDialogIndirectParam.\n<\/p>\n<p>\nOkay, this was easy. Tomorrow, we&#8217;re going to create\nthe dialog from the template.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I think a lot of confusion about the dialog manager stems from not really understanding how it works. It&#8217;s really not that bad. I&#8217;ll start by describing how dialog boxes are created over the next few articles, then move on to the dialog message loop, and wrap up with some topics regarding navigation. There will [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-36043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>I think a lot of confusion about the dialog manager stems from not really understanding how it works. It&#8217;s really not that bad. I&#8217;ll start by describing how dialog boxes are created over the next few articles, then move on to the dialog message loop, and wrap up with some topics regarding navigation. There will [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=36043"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36043\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=36043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=36043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=36043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}