{"id":28113,"date":"2007-02-07T10:00:04","date_gmt":"2007-02-07T10:00:04","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/02\/07\/why-cant-i-create-my-dialog-box-rookie-mistake-2\/"},"modified":"2007-02-07T10:00:04","modified_gmt":"2007-02-07T10:00:04","slug":"why-cant-i-create-my-dialog-box-rookie-mistake-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070207-04\/?p=28113","title":{"rendered":"Why can&#039;t I create my dialog box? Rookie mistake #2"},"content":{"rendered":"<p>\nAnother class of rookie mistake is less obvious from looking\nat the code.\n<\/p>\n<pre>\n#define DLG_SAMPLE 1\nDLG_SAMPLE DIALOGEX 32, 32, 210, 200\n...\nBEGIN\n ...\n CONTROL \"\",IDC_LISTVIEW,WC_LISTVIEW,LVS_REPORT |\n         WS_TABSTOP | WS_BORDER,\n         14,92,182, 80\n ...\nEND\nDialogBox(hinst, MAKEINTRESOURCE(DLG_SAMPLE),\n          hwnd, SampleDlgProc);\n<\/pre>\n<p>\nThe problem with this code is that we forgot to call\n<code>InitCommonControlsEx<\/code> to register the listview class.\nMore generally, the problem is that one of the controls on the\ndialog uses a window class that was not registered.\n(For example, maybe there&#8217;s a rich edit control on the dialog,\nbut nobody remembered to load the rich edit library.)\n<\/p>\n<p>\nNext time, a sophomore version of this mistake.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another class of rookie mistake is less obvious from looking at the code. #define DLG_SAMPLE 1 DLG_SAMPLE DIALOGEX 32, 32, 210, 200 &#8230; BEGIN &#8230; CONTROL &#8220;&#8221;,IDC_LISTVIEW,WC_LISTVIEW,LVS_REPORT | WS_TABSTOP | WS_BORDER, 14,92,182, 80 &#8230; END DialogBox(hinst, MAKEINTRESOURCE(DLG_SAMPLE), hwnd, SampleDlgProc); The problem with this code is that we forgot to call InitCommonControlsEx to register the listview [&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-28113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Another class of rookie mistake is less obvious from looking at the code. #define DLG_SAMPLE 1 DLG_SAMPLE DIALOGEX 32, 32, 210, 200 &#8230; BEGIN &#8230; CONTROL &#8220;&#8221;,IDC_LISTVIEW,WC_LISTVIEW,LVS_REPORT | WS_TABSTOP | WS_BORDER, 14,92,182, 80 &#8230; END DialogBox(hinst, MAKEINTRESOURCE(DLG_SAMPLE), hwnd, SampleDlgProc); The problem with this code is that we forgot to call InitCommonControlsEx to register the listview [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/28113","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=28113"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/28113\/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=28113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=28113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=28113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}