You have already seen a modal dialog box (About) in the Generic application. A modal dialog box temporarily disables the parent window and requires the user to complete the requested action before returning control to the parent window. Modal dialog boxes are useful for gathering information your application requires in order to proceed. For example, Microsoft Windows Notepad displays a modal dialog box when the user chooses the Open command from the File menu. Notepad cannot carry out the Open command until the user specifies a file.
Although you can specify almost any window style for a modal dialog box, 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 prevent input from going to the parent window, the dialog box disables the parent window before processing input. For this reason, you must not create a modal dialog box by using the WS_CHILD style, since disabling the parent window also disables all child windows belonging to the parent window.
To display a modal dialog box, use the DialogBox or DialogBoxIndirect function. To terminate a modal dialog box, use the EndDialog function.