共用方式為


CSimpleDialog::DoModal

Invokes a modal dialog box and returns the dialog-box result when done.

INT_PTR DoModal(
   HWND hWndParent = ::GetActiveWindow() 
);

Parameters

  • hWndParent
    A handle to the parent of the dialog box. If no value is provided, the parent is set to the current active window.

Return Value

If successful, the return value is the resource ID of the control that dismissed the dialog box.

If the function fails, the return value is –1. To get extended error information, call GetLastError.

Remarks

This method handles all interaction with the user while the dialog box is active. This is what makes the dialog box modal; that is, the user cannot interact with other windows until the dialog box is closed.

Requirements

Header: atlwin.h

See Also

Concepts

CSimpleDialog Class

CSimpleDialog Members