WM_INITDIALOG

This message is sent immediately before a dialog box is displayed. By processing this message, an application can perform any initialization before the dialog box is made visible.

Parameter Description  

wParam Identifies the first control item in the dialog box that can be given the input focus. Generally, this is the first item in the dialog box with WS_TABSTOP style.  
lParam Is the value passed as the dwInitParam parameter of the function if the dialog box was created by any of the following functions:  
  CreateDialogIndirectParam  
  CreateDialogParam  
  DialogBoxIndirectParam  
  DialogBoxParam  
  Otherwise, lParam is not used.  

Comments

If the application returns a nonzero value in response to the WM_INITDIALOG message, Windows sets the input focus to the item identified by the handle in the wParam parameter. The application can return FALSE only if it has set the input focus to one of the controls of the dialog box.