HOWTO: Use a Modeless Dialog Box with No Dialog Function

ID: Q72136


The information in this article applies to:


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 box is useful when the no controls or other input facilities are required. In this case, using NULL simplifies the programming.

However, the dialog box must be closed through some means other than a push button (for example, via 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.


Keywords          : kbDlg kbNTOS kbGrpUser kbWinOS 
Version           : 
Platform          : 
Issue type        : kbhowto 

Last Reviewed: March 6, 1999