Compartilhar via


CPropertyPage::OnQueryCancel

This member function is called by the framework when the user clicks the Cancel button and before the cancel action has taken place.

virtual BOOL OnQueryCancel( );

Return Value

Returns FALSE to prevent the cancel operation or TRUE to allow it.

Remarks

Override this member function to specify an action the program takes when the user clicks the Cancel button.

The default implementation of OnQueryCancel returns TRUE.

Example

// Query the user whether to abort the changes if the new selected
// color (m_Color) is different from the initial color 
// (m_InitialColor) when the CPropertySheet dialog is first shown.
// CColorPage is a CPropertyPage-derived class.
BOOL CColorPage::OnQueryCancel() 
{
   if (m_InitialColor != m_Color)
   {
      if (AfxMessageBox(_T("Abort the changes?"), MB_YESNO) == IDNO)
         return FALSE;  
   }

   return CPropertyPage::OnQueryCancel();
}

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertyPage Class

Hierarchy Chart

Other Resources

CPropertyPage Members