ehandojo
asked on
How to add confirmation message box when a Dialog's CANCEL button is pressed
How can I add a confirmation message box when a CANCEL button of a dialog box is pressed ?
Where should I create the confirmation message box. The confirmation message box will have a Yes and No button.
If the No button is selected then I don't want to close the dialog box. If the Yes button is selected then I want to continue closing of the dialog box.
Where should I create the confirmation message box. The confirmation message box will have a Yes and No button.
If the No button is selected then I don't want to close the dialog box. If the Yes button is selected then I want to continue closing of the dialog box.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That is different. CPropertyPage is derived from CDialog, but CPropertyPage is integrated into CPropertySheet and the close operation is done by CPropertySheet. In this case, override CPropertyPage::OnQueryCanc el().
CPropertyPage::OnQueryCanc el
virtual BOOL OnQueryCancel( );
Return Value
Returns FALSE to prevent the cancel operation or TRUE to allow it.
Remarks
This member function is called by the framework when the user clicks the Cancel button and before the cancel action has taken place.
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.
CPropertyPage::OnQueryCanc
virtual BOOL OnQueryCancel( );
Return Value
Returns FALSE to prevent the cancel operation or TRUE to allow it.
Remarks
This member function is called by the framework when the user clicks the Cancel button and before the cancel action has taken place.
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.
ASKER
thank you for the answer.
ASKER
I tried to override the OnCancel virtual function on my CPropertyPage derived class and add a confirmation message box, but either Yes and No answer will still close the wizard.