Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
virtualvoidOnCancel();
Remarks
The framework calls this member function when the user clicks the Cancel button or presses the ESC key in a modal or modeless dialog box.
Override this member function to perform Cancel button action. The default simply terminates a modal dialog box by calling EndDialog and causing DoModal to return IDCANCEL.
If you implement the Cancel button in a modeless dialog box, you must override the OnCancel member function and call DestroyWindow from within it. Don’t call the base-class member function, because it calls EndDialog, which will make the dialog box invisible but not destroy it.
Example
// MyDialog.cpp
#include "MyDialog.h"
void CMyDialog::OnCancel()
{
// TODO: Add extra cleanup here
// Ensure that you reset all the values back to the
// ones before modification. This handler is called
// when the user doesn't want to save the changes.
if ( AfxMessageBox("Are you sure you want to abort the changes?",
MB_YESNO) == IDNO )
return; // Give the user a chance if he has unknowingly hit the
// Cancel button. If he says No, return. Don't reset. If
// Yes, go ahead and reset the values and close the dialog.
m_nMyValue = m_nPrevValue;
m_pMyString = NULL;
CDialog::OnCancel();
}
CDialog Overview | Class Members | Hierarchy Chart
See Also CDialog::OnOK, CDialog::EndDialog