Disabling the Cancel button in a Wizard

21 years ago mfc

CPropertySheet provides the SetWizardButtons function, allowing you to enable or disable the “Back” or “Next” buttons. It doesn’t, however, allow you to disable the “Cancel” button.

Here’s how:

    CWnd *pCancel = GetParent()->GetDlgItem(IDCANCEL);
    if (pCancel)
    	pCancel->EnableWindow(FALSE);