共用方式為


Destroying the Dialog Box

OverviewHow Do I

Modal dialog boxes are normally created on the stack frame and destroyed when the function that created them ends. The dialog object’s destructor is called when the object goes out of scope.

Modeless dialog boxes are normally created and owned by a parent view or frame window — the application’s main frame window or a document frame window. The default handler calls , which destroys the dialog-box window. If the dialog box stands alone, with no pointers to it or other special ownership semantics, you should override to destroy the C++ dialog object. You should also override and call DestroyWindow from within it. If not, the owner of the dialog box should destroy the C++ object when it is no longer necessary.

See Also   Life Cycle of a Dialog Box