DIALOG
and DIALOGEX
resources
DIALOGEX
Size/Type | Description |
---|---|
u16 | Dialog version (1 for DIALOGEX ) |
u16 | 0xFFFF for DIALOGEX |
u32 | Help ID |
u32 | Extended style |
u32 | Style |
u16 | Number of controls |
u16 | X |
u16 | Y |
u16 | Width |
u16 | Height |
NameOrOrdinal | Menu |
NameOrOrdinal | Dialog class |
Null-teriminated UTF-16 String | Title |
- Multiple of each optional statement is allowed, and the last one specified takes precedence, with the exception of
CLASS
andMENU
(see below).
CLASS
and MENU
quirks
MENU
is a properNameOrOrdinal
, in that it can be unquoted, contain “ within it, etc.- However, it is parsed differently than a
NameOrOrdinal
used for resource id/types. Whenever the first character is a number, it is treated as a number. Anything after that is treated as a digit with the value<UTF-16 code unit> - '0'
(where'0'
is0x30
, and using wrapping underflow for ascii values < 0x30). Some examples:3200
->3200
(ordinal)1+1
->51
(ordinal)1|2
->862
(ordinal)1a2
->592
(ordinal)1a
->59
(ordinal)1A
->27
(ordinal)1!
->65531
(ordinal)0Œ
->0x122
(ordinal,Œ
isU+0152
, so- 0x30
is0x122
)0<U+10002>
->0x49F2
(ordinal,<U+10002>
is0xD800 0xDC02
in UTF-16, so0xD800 - 0x30
is0xD7D0
, multiplied by 10 (with wrapping overflow) that is0x6E20
, then0xDC02 - 0x30
is0xDBD2
, added to0x6E20
(wrapping on overflow) is0x49F2
)1PleaseDon'tInterpretThisAsANumber
->28404
(ordinal)3200-1600
->24848
(ordinal)3200-1600+1
->59919
(ordinal)(3200-1600)
->(3200-1600)
(string)
- However, it is parsed differently than a
- If
CLASS
orMENU
is specified first as an ordinal with in a resource, then any moreCLASS
orMENU
optional statements will also be treated as an ordinal, e.g.1 DIALOGEX 1,2,3,4 CLASS 1 CLASS "this would normally be a string" {}
will result in a resource with a class of47959
as an ordinal. CLASS
must be either a number, number expression, or a quoted string literal. If a quoted string is to be interpretted as a number due to the quirk in the previous point, then it is parsed first and then uses the same evaluation asMENU
outlined above.
FONT
- If a
FONT
optional statement is present,DS_SETFONT
(0x40
) is implied italic
setting of aFONT
statement is a number evaluated as au16
and then interpretted as a boolean (so65536
overflows to 0 which is interpretted asFALSE
, and so is65536L
[but65537
overflows to 1 which isTRUE
]).charset
setting of aFONT
statement is truncated to au8
.- The comma between
point_size
andtypeface
parameters ofFONT
is optional (and can also be > 1), e.g.FONT 1 "name"
is valid and so isFONT 1,, ,, "name"
. The commas between the rest of the parameters are required and there can only be exactly 1 between those parameters.