You have already seen a modal dialog box (About) in the Generic application. A modal dialog box temporarily disables the parent window and forces the user to complete the requested action before returning control to the parent window. Modal dialog boxes are particularly useful for gathering information your application requires in order to proceed. For example, Windows Notepad displays a modal dialog box when the user chooses the Open command from the File menu. Notepad cannot proceed with the Open command until the user specifies a file.
Although you can give a modal dialog box almost any window style, the recommended styles are DS_MODALFRAME, WS_CAPTION, and WS_SYSMENU. The DS_MODALFRAME style gives the dialog box its characteristic thick border.
A modal dialog box starts its own message loop to process messages from the application queue without returning to the WinMain function. To keep input from going to the parent window, the dialog box disables the parent window before processing input. For this reason, a modal dialog box must never be created using the WS_CHILD style, since disabling the parent window also disables all child windows belonging to the parent.
To display a modal dialog box, use the DialogBox function. To terminate a modal dialog box, use the EndDialog function.