This documentation is archived and is not being maintained.

Creating a Dialog Box that Users Can't Exit at Run Time

You can create a dialog box that a user cannot exit at run time. This type of dialog box is useful for logon screens and application or document locks.

To create a dialog box that users can't exit at run time

  1. Disable the system menu and the Close button for the dialog box.
  2. Delete the Cancel and OK buttons.

During run time, a user cannot exit a modal dialog box with these characteristics.

To allow testing of this type of dialog box, the test dialog box function detects the ESC keystroke, also known as the VK_ESCAPE virtual key. No matter how the dialog box will behave at run time, you can terminate it in test mode by pressing ESC.

Note   For MFC applications, you need to override the default behavior of OnOK and OnCancel to create a dialog box that users can't exit at run time. For example, if you try doing the steps mentioned above on the About box of a default MFC wizard-generated application, you'll see that Esc and Enter will still dismiss the dialog box.

For information on adding resources to managed projects, please see Resources in Applications in the .NET Framework Developer's Guide. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resources strings to properties, see Walkthrough: Localizing Windows Forms and Walkthrough: Localizing Web Forms.

Requirements

Win32

See Also

Creating a New Resource | Resource Files | Dialog Editor | Scheduler Sample: Demonstrates HTML-Based Dialog Boxes

Show: