A brief description of the method of setting the focus of the MFC dialog box

  • 2020-04-02 02:54:27
  • OfStack

This article briefly describes the method of setting the focus of the MFC dialog box, to share with you for your reference. The specific implementation method is as follows:

There are two specific methods:

1. Set the TAB order of the dialog control. Press Ctrl+D to see it. Set the TAB order for the space that needs to be set to focus to 1.

2. The OnInitDialog returns FALSE. The explanation is as follows :(extract to MSDN)
 
If OnInitDialog returns nonzero, Windows sets the input focus to the first control in the dialog box.

The application can return 0 only if it has explicitly set The input focus to one of The controls in The dialog box.

Hope that this article is helpful to everyone's MFC programming.


Related articles: