HOWTO: Use a Modeless Dialog Box with No Dialog Function

ID: Q72136


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1
  • Microsoft Windows 2000


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.

Additional query words:

Keywords : kbDlg kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS
Version : WINDOWS:3.0,3.1
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: January 28, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.