Close MFC Dialog
How to Close a Dialog Box in MFC Using EndDialog Function

Learn how to properly close a dialog box in MFC applications using the EndDialog function with IDOK or IDCANCEL return codes.