windows_programming_notes.nbk: Home | Index | Next Page: WM_INITMENU | Previous Page: WM_IME_STARTCOMPOSITION


 WM_INITDIALOG

The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. A window receives this message through its WindowProc function.

    LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_INITDIALOG
      WPARAM wParam,   // handle to control (HWND)
      LPARAM lParam    // initialization parameter
    );

Parameters

Return Values

The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.

The dialog box procedure should return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Remarks

The control to receive the default keyboard focus is always the first control in the dialog box that is visible, not disabled, and that has the WS_TABSTOP style. When the dialog box procedure returns TRUE, the system checks the control to ensure that the procedure has not disabled it. If it has been disabled, the system sets the keyboard focus to the next control that is visible, not disabled, and has the WS_TABSTOP.

An application can return FALSE only if it has set the keyboard focus to one of the controls of the dialog box.

Requirements


windows_programming_notes.nbk: Home | Index | Next Page: WM_INITMENU | Previous Page: WM_IME_STARTCOMPOSITION


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time