About WM_GETDLCODE this news
The message WM_GETDLCODE can be used to control the behavior of the dialog manager. In a previous article, we described how to control the automatic selection behavior of the edit box through the DLGC_HASSETSEL flag.
Originally, I wanted to talk about some other signs, but I found that the description in [Knowledge Base 83302] is more comprehensive, so I don’t plan to go into a long discussion, but just mention the important points that I think are important. .
Are you seated?
Among the many flags, DLGC_WANTMESSAGE is the most useful one. It can be used to control the dialog box manager to prohibit the dialog box manager from processing the specified message.
For example, when the input focus is on a particular control, and you don’t want the user to press the ESC button to exit the dialog box, but you want the control to handle it, you can handle the message WM_GETDLGCODE and check its LPARAM parameters. If you find that the user pressed the ESC button, you can return to DLGC_WANTMESSAGE, so that this message will not be processed by the dialog manager by default.
Several other flags, such as DLGC_WANTCHARS, DLGC_WANTTAB and DLGC_WANTARROWS, are also used in similar ways. They are mainly used to check certain types of messages.
to sum up
Before preparing to modify the default behavior of the window, we should first consider whether it is really necessary to do so.
Because if the message processing logic is improperly handled, it will make your program behave difficult to use, or does not meet the user's operational expectations, because the user has become accustomed to the unified behavior of other programs.