DefDlgProc

  LRESULT DefDlgProc(hwndDlg, uMsg, wParam, lParam)    
  HWND hwndDlg; /* handle of dialog box */
  UINT uMsg; /* message */
  WPARAM wParam; /* first message parameter */
  LPARAM lParam; /* second message parameter */

The DefDlgProc function provides default processing for any Windows messages that a dialog box with a private window class does not process.

Parameters

hwndDlg

Identifies the dialog box.

uMsg

Specifies the message number.

wParam

Specifies additional message-dependent information.

lParam

Specifies additional message-dependent information.

Return Value

The return value specifies the result of the message processing and depends on the actual message sent.

Comments

The DefDlgProc function is the window procedure for the DIALOG window class. An application that creates new window classes that inherit dialog box functionality should use this function. DefDlgProc is not intended to be called as the default handler for messages within a dialog box procedure, since doing so will result in recursive execution.

An application creates a dialog box by calling one of the following functions:

Function Description

CreateDialog Creates a modeless dialog box.
CreateDialogIndirect Creates a modeless dialog box.
CreateDialogIndirectParam Creates a modeless dialog box and passes data to it when it is created.
CreateDialogParam Creates a modeless dialog box and passes data to it when it is created.
DialogBox Creates a modal dialog box.
DialogBoxIndirect Creates a modal dialog box.
DialogBoxIndirectParam Creates a modal dialog box and passes data to it when it is created.
DialogBoxParam Creates a modal dialog box and passes data to it when it is created.

To create a new window class that inherits dialog functionality, query the default dialog class information and create a clone of this class with your own application attributes:

GetClassInfo(hModule, (LPSTR)DIALOGCLASS, lpWndClass);

lpWndClass.lpszClassName = "mydialogclass";

RegisterClass(lpWndClass);

Or, you can create your own class directly, as long as you reserve the proper number of window extra bytes that dialog windows require:

wndclass.style = 0L;

...

...

wndclass.cbWndExtra = DLGWINDOWEXTRA;

wndclass.lpfnWndProc = DefDlgProc;

wndclass.lpszClassName = "mydialogclass";

RegisterClass(&wndclass);

If your application wants to use window words in windows of this class, they must be located past DLGWINDOWEXTRA, which is a byte count.

See Also

DefWindowProc