INF: Using a Modeless Dialog Box with No Dialog Function

ID Number: Q72136

3.00

WINDOWS

Summary:

When creating a modeless dialog box with the default dialog class, an

application normally passes a procedure-instance address of the dialog

function to the CreateDialog() function. This dialog function

processes messages such as WM_INITDIALOG and WM_COMMAND, returning

TRUE or FALSE.

It is acceptable to create a modeless dialog box that uses NULL for

the lpDialogFunc parameter of CreateDialog(). This type of dialog is

useful when the no controls or other input facilities are required. In

this case, using NULL simplifies the programming.

However, the dialog must be closed through some means other than a

push button. This might be a timer event. NOTE: A modal dialog box

that does not provide a means of closing itself will hang its parent

application because control will never return from the DialogBox()

function call.

If lpDialogFunc is NULL, no WM_INITDIALOG message will be sent, and

DefDlgProc() does not attempt to call a dialog function. Instead,

DefDlgProc() handles all messages for the dialog. The application that

created the modeless dialog must explicitly call DestroyWindow() to

free its system resources.