Holy cow, I wrote a book!
The WM_GETDLCODE message lets you influence the behavior of the
A previous entry on using WM_GETDLGCODE
described the DLGC_HASSETSEL flag which controls
whether edit control content is auto-selected when focus changes.
I was going to write a bit about the other flags, but it turns out
Knowledge Base Article 83302 already covers this, so I'll just
call out some highlights.
The DLGC_WANTMESSAGE flag is the most powerful one.
It lets your control prevent the dialog manager from handling
a message. So for example if you don't want ESC to dismiss the
dialog box when focus is on a particular control but rather be
delivered to the control itself, handle the
WM_GETDLGCODE message and peek at the lParam.
If it is a press of the ESC key, then return DLGC_WANTMESSAGE
so the message will not be handled by the dialog manager.
The DLGC_WANTCHARS, DLGC_WANTTAB and
DLGC_WANTARROWS flags are just conveniences that
save you the trouble of checking certain categories of messages.