This wasted several hours for me this morning. The MSDN docs for DLGITEMTEMPLATEEX are wrong: there is an extra WORD member after the id member, call it reserved.

Note that this struct is not in any windows header: you are expected to cut & paste it into your code. (Always a good idea...)

I am grokking dialog templates, and what fun it is. Raymond has already described in great detail the evolution of these crazy structures, and if you look carefully you will see that he thinks the id member is a DWORD. I took a look at the Windows source code and in fact the id is a WORD, but there is an unused word after it. (The Windows tree itself contains a bunch of definitions of this type, because it isn't in the internal headers either, and all but one have ID as a DWORD).

Once thing that Raymond doesn't explicitly call out is the subtle change in the extra byte count compared to DLGITEMTEMPLATE - for the former MSDN says the size (when non-zero) includes the WORD itself. For the latter it makes no such claims. Interestingly I found both algorithms in a few places in the Windows tree that handles this extra byte counts, so I'm not even sure how they should be treated. As my dialogs have yet to have this member non-zero, I'm not caring right now.