{"id":38773,"date":"2004-06-22T07:00:00","date_gmt":"2004-06-22T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/06\/22\/the-evolution-of-dialog-templates-16-bit-extended-templates\/"},"modified":"2004-06-22T07:00:00","modified_gmt":"2004-06-22T07:00:00","slug":"the-evolution-of-dialog-templates-16-bit-extended-templates","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040622-00\/?p=38773","title":{"rendered":"The evolution of dialog templates &#8211; 16-bit Extended Templates"},"content":{"rendered":"<p>\nThe next step in the evolution of dialog templates is the\nExtended Dialog or DIALOGEX.\nFirst, let&#8217;s look at the 16-bit version.\n<\/p>\n<p>\nThe 16-bit extended dialog template is purely historical.\nThe only operating systems to support it were the Windows 95\/98\/Me series.\nIt is interesting only as a missing link in the evolution towards\nthe 32-bit extended dialog template.\n<\/p>\n<p>\nThe basic rules are the same as for the non-extended template.\nThe extended dialog template starts off with a different header:\n<\/p>\n<pre>\nWORD  wDlgVer;      \/\/ version number - always 1\nWORD  wSignature;   \/\/ always 0xFFFF\nDWORD dwHelpID;     \/\/ help ID\nDWORD dwExStyle;    \/\/ window extended style\nDWORD dwStyle;      \/\/ dialog style\nBYTE  cItems;       \/\/ number of controls in this dialog\nWORD  x;            \/\/ x-coordinate\nWORD  y;            \/\/ y-coordinate\nWORD  cx;           \/\/ width\nWORD  cy;           \/\/ height\n<\/pre>\n<p>\nThe first two fields specify a version number (so far, only\nversion 1 extended dialogs have been defined), and a signature\nvalue 0xFFFF which allows this template to be distinguished\nfrom a non-extended dialog template.\n<\/p>\n<p>\nNext come two new fields.\nThe help identifier is an arbitrary 32-bit value that you can retrieve from the\ndialog later with the\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/shellcc\/platform\/shell\/reference\/functions\/getwindowcontexthelpid.asp\">\nGetWindowContextHelpId<\/a> function.\nThe extended dialog style you&#8217;ve seen before.\n<\/p>\n<p>\nAs before, after the header come the strings.\nFirst comes the menu, then the class, then dialog title,\nall encoded the same way as with the non-extended template.\n<\/p>\n<p>\nIf the DS_SETFONT style is set, then a custom font exists\nin the template. The format of the font information is slightly\ndifferent for extended templates.\nIn classic templates, all you get is a WORD of point size and\na font name.  But in the extended template, the font information\nis a little richer:\n<\/p>\n<pre>\nWORD wPoint;        \/\/ point size\nWORD wWeight;       \/\/ font weight\nBYTE bItalic;       \/\/ 1 if italic, 0 if not\nBYTE bCharSet;      \/\/ character set (see <a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/gdi\/fontext_8fp0.asp\">CreateFont<\/a>)\nCHAR szFontName[];  \/\/ variable-length\n<\/pre>\n<p>\nNew fields are the weight, character set, and whether the font is italic.\n<\/p>\n<p>\nAfter the header come the dialog item templates, each of which\nlooks like this:\n<\/p>\n<pre>\nDWORD dwHelpID;     \/\/ help identifier\nDWORD dwExStyle;    \/\/ window extended style\nDWORD dwStyle;      \/\/ window style\nWORD  x;            \/\/ x-coordinate (DLUs)\nWORD  y;            \/\/ y-coordinate (DLUs)\nWORD  cx;           \/\/ width (DLUs)\nWORD  cy;           \/\/ height (DLUs)\nDWORD wID;          \/\/ control ID\nCHAR  szClassName[];\/\/ variable-length (possibly ordinal)\nCHAR  szText[];     \/\/ variable-length (possibly ordinal)\nWORD  cbExtra;      \/\/ amount of extra data\nBYTE  rgbExtra[cbExtra]; \/\/ extra data follows (usually none)\n<\/pre>\n<p>\nThis takes the classic item template and adds the following:\n<\/p>\n<ul>\n<li>New dwHelpID and dwExStyle fields.\n<li>dwStyle field moved.\n<li>control ID expanded to DWORD.\n<li>cbExtra expanded to WORD.\n<\/ul>\n<p>\nNot that expanding the control ID to a 32-bit value accomplishes much\nin 16-bit Windows, but it&#8217;s there nonetheless.\n<\/p>\n<p>\nAnd that&#8217;s all.\n<\/p>\n<p>\nNow the obligatory annotated hex dump.\n<\/p>\n<pre>\n0000  01 00 FF FF 00 00 00 00-00 00 00 00 C4 00 C8 80  ................\n0010  0B 24 00 2C 00 E6 00 5E-00 00 00 52 65 70 6C 61  .$.,...^...Repla\n0020  63 65 00 08 00 90 01 00-00 4D 53 20 53 68 65 6C  ce.......MS Shel\n0030  20 44 6C 67 00 00 00 00-00 00 00 00 00 00 00 02   Dlg............\n0040  50 04 00 09 00 30 00 08-00 FF FF FF FF 82 46 69  P....0........Fi\n0050  26 6E 64 20 77 68 61 74-3A 00 00 00 00 00 00 00  &amp;nd what:.......\n0060  00 00 00 00 80 00 83 50-36 00 07 00 72 00 0C 00  .......P6...r...\n0070  80 04 00 00 81 00 00 00-00 00 00 00 00 00 00 00  ................\n0080  00 00 02 50 04 00 1A 00-30 00 08 00 FF FF FF FF  ...P....0.......\n0090  82 52 65 26 70 6C 61 63-65 20 77 69 74 68 3A 00  .Re&amp;place with:.\n00A0  00 00 00 00 00 00 00 00-00 00 80 00 83 50 36 00  .............P6.\n00B0  18 00 72 00 0C 00 81 04-00 00 81 00 00 00 00 00  ..r.............\n00C0  00 00 00 00 00 00 03 00-03 50 05 00 2E 00 68 00  .........P....h.\n00D0  0C 00 10 04 00 00 80 4D-61 74 63 68 20 26 77 68  .......Match &amp;wh\n00E0  6F 6C 65 20 77 6F 72 64-20 6F 6E 6C 79 00 00 00  ole word only...\n00F0  00 00 00 00 00 00 00 00-03 00 01 50 05 00 3E 00  ...........P..&gt;.\n0100  3B 00 0C 00 11 04 00 00-80 4D 61 74 63 68 20 26  ;........Match &amp;\n0110  63 61 73 65 00 00 00 00-00 00 00 00 00 00 00 01  case............\n0120  00 03 50 AE 00 04 00 32-00 0E 00 01 00 00 00 80  ..P....2........\n0130  26 46 69 6E 64 20 4E 65-78 74 00 00 00 00 00 00  &amp;Find Next......\n0140  00 00 00 00 00 00 00 03-50 AE 00 15 00 32 00 0E  ........P....2..\n0150  00 00 04 00 00 80 26 52-65 70 6C 61 63 65 00 00  ......&amp;Replace..\n0160  00 00 00 00 00 00 00 00-00 00 00 03 50 AE 00 26  ............P..&amp;\n0170  00 32 00 0E 00 01 04 00-00 80 52 65 70 6C 61 63  .2........Replac\n0180  65 20 26 41 6C 6C 00 00-00 00 00 00 00 00 00 00  e &amp;All..........\n0190  00 00 00 03 50 AE 00 37-00 32 00 0E 00 02 00 00  ....P..7.2......\n01A0  00 80 43 61 6E 63 65 6C-00 00 00 00 00 00 00 00  ..Cancel........\n01B0  00 00 00 00 00 03 50 AE-00 4B 00 32 00 0E 00 0E  ......P..K.2....\n01C0  04 00 00 80 26 48 65 6C-70 00 00 00              ....&amp;Help...\n<\/pre>\n<p>\nOnce again, we start with the header.\n<\/p>\n<pre>\n0000  01 00         \/\/ wVersion\n0002  FF FF         \/\/ wSignature\n0004  00 00 00 00   \/\/ dwHelpID\n0008  00 00 00 00   \/\/ dwExStyle\n000C  C4 00 C8 80   \/\/ dwStyle\n0010  0B            \/\/ cItems\n0011  24 00 2C 00   \/\/ x, y\n0015  E6 00 5E 00   \/\/ cx, cy\n<\/pre>\n<p>\nThe header breaks down as follows:\n<\/p>\n<table>\n<col SPAN=\"3\" VALIGN=\"TOP\">\n<tr>\n<td>wVersion<\/td>\n<td>= 0x0001<\/td>\n<td>= 1<\/td>\n<\/tr>\n<tr>\n<td>wSignature<\/td>\n<td>= 0xFFFF<\/td>\n<\/tr>\n<tr>\n<td>dwHelpID<\/td>\n<td>= 0x00000000<\/td>\n<td>= 0<\/td>\n<\/tr>\n<tr>\n<td>dwExStyle<\/td>\n<td>= 0x00000000<\/td>\n<td>= 0<\/td>\n<\/tr>\n<tr>\n<td>dwStyle<\/td>\n<td>= 0x80C800C4<\/td>\n<td>= WS_POPUP | WS_CAPTION | WS_SYSMENU |\n          DS_SETFONT | DS_MODALFRAME | DS_3DLOOK\n    <\/td>\n<\/tr>\n<tr>\n<td>cItems<\/td>\n<td>= 0x0B<\/td>\n<td>= 11<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>= 0x0024<\/td>\n<td>= 36<\/td>\n<\/tr>\n<tr>\n<td>y<\/td>\n<td>= 0x002C<\/td>\n<td>= 44<\/td>\n<\/tr>\n<tr>\n<td>cx<\/td>\n<td>= 0x00E6<\/td>\n<td>= 230<\/td>\n<\/tr>\n<tr>\n<td>cy<\/td>\n<td>= 0x005E<\/td>\n<td>= 94<\/td>\n<\/tr>\n<\/table>\n<p>\nNext come the menu name, class name, and dialog title:\n<\/p>\n<pre>\n0019  00            \/\/ no menu\n001A  00            \/\/ default dialog class\n001B  52 65 70 6C 61 63 65 00 \/\/ \"Replace\"\n<\/pre>\n<p>\nSame as the 16-bit classic template.\n<\/p>\n<p>\nThe presence of DS_SETFONT means that there&#8217;s font information ahead.\nThis looks slightly different.\n<\/p>\n<pre>\n0023  08 00         \/\/ wSize = 8\n0025  90 01         \/\/ wWeight = 0x02BC = 700 = FW_NORMAL\n0027  00            \/\/ Italic\n0028  00            \/\/ Character set = 0x00 = ANSI_CHARSET\n0029  4D 53 20 53 68 65 6C 20 44 6C 67 00\n                    \/\/ \"MS Shell Dlg\"\n<\/pre>\n<p>\nNow follow the extended dialog item templates.\nThis should all be old hat by now, so I won&#8217;t go into detail.\n<\/p>\n<pre>\n\/\/ First control\n0035  00 00 00 00   \/\/ dwHelpID\n0039  00 00 00 00   \/\/ dwExStyle\n003D  00 00 02 50   \/\/ dwStyle\n0041  04 00 09 00   \/\/ x, y\n0045  30 00 08 00   \/\/ cx, cy\n0049  FF FF FF FF   \/\/ dwID\n004D  82            \/\/ szClass = ordinal 0x82 = \"static\"\n004E  46 69 26 6E 64 20 77 68 61 74 3A 00\n                    \/\/ \"Fi&amp;nd what:\"\n005A  00 00         \/\/ no extra data\n\/\/ Second control\n005C  00 00 00 00   \/\/ dwHelpID\n0060  00 00 00 00   \/\/ dwExStyle\n0064  80 00 83 50   \/\/ dwStyle\n0068  36 00 07 00   \/\/ x, y\n006C  72 00 0C 00   \/\/ cx, cy\n0070  80 04 00 00   \/\/ dwID\n0074  81            \/\/ \"edit\"\n0075  00            \/\/ \"\"\n0076  00 00         \/\/ no extra data\n\/\/ Third control\n0078  00 00 00 00   \/\/ dwHelpID\n007C  00 00 00 00   \/\/ dwExStyle\n0080  00 00 02 50   \/\/ dwStyle\n0084  04 00 1A 00   \/\/ x, y\n0088  30 00 08 00   \/\/ cx, cy\n008C  FF FF FF FF   \/\/ dwID\n0090  82            \/\/ \"static\"\n0091  52 65 26 70 6C 61 63 65 20 77 69 74 68 3A 00\n                    \/\/ \"Re&amp;place with:\"\n00A0  00 00         \/\/ no extra data\n\/\/ Fourth control\n00A2  00 00 00 00   \/\/ dwHelpID\n00A6  00 00 00 00   \/\/ dwExStyle\n00AA  80 00 83 50   \/\/ dwStyle\n00AE  36 00 18 00   \/\/ x, y\n00B2  72 00 0C 00   \/\/ cx, cy\n00B6  81 04 00 00   \/\/ dwID\n00BA  81            \/\/ \"edit\"\n00BB  00            \/\/ \"\"\n00BC  00 00         \/\/ no extra data\n\/\/ Fifth control\n00BE  00 00 00 00   \/\/ dwHelpID\n00C2  00 00 00 00   \/\/ dwExStyle\n00C6  03 00 03 50   \/\/ dwStyle\n00CA  05 00 2E 00   \/\/ x, y\n00CE  68 00 0C 00   \/\/ cx, cy\n00D2  10 04 00 00   \/\/ dwID\n00D6  80            \/\/ \"button\"\n00D7  4D 61 74 63 68 20 26 77 68 6F 6C 65 20 77\n      6F 72 64 20 6F 6E 6C 79 00\n                    \/\/ \"Match &amp;whole word only\"\n00EE  00 00         \/\/ no extra data\n\/\/ Sixth control\n00F0  00 00 00 00   \/\/ dwHelpID\n00F4  00 00 00 00   \/\/ dwExStyle\n00F8  03 00 01 50   \/\/ dwStyle\n00FC  05 00 3E 00   \/\/ x, y\n0100  3B 00 0C 00   \/\/ cx, cy\n0104  11 04 00 00   \/\/ dwID\n0108  80            \/\/ \"button\"\n0109  4D 61 74 63 68 20 26 63 61 73 65 00\n                    \/\/ \"Match &amp;case\"\n0115  00 00         \/\/ no extra data\n\/\/ Seventh control\n0117  00 00 00 00   \/\/ dwHelpID\n011B  00 00 00 00   \/\/ dwExStyle\n011F  01 00 03 50   \/\/ dwStyle\n0123  AE 00 04 00   \/\/ x, y\n0127  32 00 0E 00   \/\/ cx, cy\n012B  01 00 00 00   \/\/ dwID\n012F  80            \/\/ \"button\"\n0130  26 46 69 6E 64 20 4E 65 78 74 00\n                    \/\/ \"&amp;Find Next\"\n013B  00 00         \/\/ no extra data\n\/\/ Eighth control\n013D  00 00 00 00   \/\/ dwHelpID\n0141  00 00 00 00   \/\/ dwExStyle\n0145  00 00 03 50   \/\/ dwStyle\n0149  AE 00 15 00   \/\/ x, y\n014D  32 00 0E 00   \/\/ cx, cy\n0151  00 04 00 00   \/\/ dwID\n0155  80            \/\/ \"button\"\n0156  26 52 65 70 6C 61 63 65 00\n                    \/\/ \"&amp;Replace\"\n015F  00 00         \/\/ no extra data\n\/\/ Ninth control\n0161  00 00 00 00   \/\/ dwHelpID\n0165  00 00 00 00   \/\/ dwExStyle\n0169  00 00 03 50   \/\/ dwStyle\n016D  AE 00 26 00   \/\/ x, y\n0171  32 00 0E 00   \/\/ cx, cy\n0175  01 04 00 00   \/\/ dwID\n0179  80            \/\/ \"button\"\n017A  52 65 70 6C 61 63 65 20 26 41 6C 6C 00\n                    \/\/ \"Replace &amp;All\"\n0187  00 00         \/\/ no extra data\n\/\/ Tenth control\n0189  00 00 00 00   \/\/ dwHelpID\n018D  00 00 00 00   \/\/ dwExStyle\n0191  00 00 03 50   \/\/ dwStyle\n0195  AE 00 37 00   \/\/ x, y\n0199  32 00 0E 00   \/\/ cx, cy\n019D  02 00 00 00   \/\/ dwID\n01A1  80            \/\/ \"button\"\n01A2  43 61 6E 63 65 6C 00\n                    \/\/ \"Cancel\"\n01A9  00 00         \/\/ no extra data\n\/\/ Eleventh control\n01AB  00 00 00 00   \/\/ dwHelpID\n01AF  00 00 00 00   \/\/ dwExStyle\n01B3  00 00 03 50   \/\/ dwStyle\n01B7  AE 00 4B 00   \/\/ x, y\n01BB  32 00 0E 00   \/\/ cx, cy\n01BF  0E 04 00 00   \/\/ dwID\n01C3  80            \/\/ \"button\"\n01C4  26 48 65 6C 70 00\n                    \/\/ \"&amp;Help\"\n01CA  00 00         \/\/ no extra data\n<\/pre>\n<p>\nThe original dialog template is the one you&#8217;ve seen twice already,\nwith only one change:  The DIALOG keyword has been changed to DIALOGEX.<\/p>\n<pre>\n<font COLOR=\"red\">DIALOGEX<\/font> 36, 44, 230, 94\n...\n<\/pre>\n<p>\nTomorrow, we reach the modern era with the 32-bit DIALOGEX template.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The next step in the evolution of dialog templates is the Extended Dialog or DIALOGEX. First, let&#8217;s look at the 16-bit version. The 16-bit extended dialog template is purely historical. The only operating systems to support it were the Windows 95\/98\/Me series. It is interesting only as a missing link in the evolution towards the [&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":[2],"class_list":["post-38773","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>The next step in the evolution of dialog templates is the Extended Dialog or DIALOGEX. First, let&#8217;s look at the 16-bit version. The 16-bit extended dialog template is purely historical. The only operating systems to support it were the Windows 95\/98\/Me series. It is interesting only as a missing link in the evolution towards the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/38773","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=38773"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/38773\/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=38773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=38773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=38773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}