Question

Hey guys..I am designing a set-up wizard using CPropertySheet and CpropertyPage in MFC application...I have completed the design but the thing is..In normal CProperty Sheet there are four default buttons "BACK NEXT FINISH HELP"...but I want only NEXT and FINISH buttons ...I used the following code to do that but its giving me a run time error.stating.."stack overflow" I am not sure where exactly to include this code(i mean in which class)..nor how to utilize this function.. can any one help me..

BOOL CExtractorFinalUIDlg::OnSetActive() { CSelfExtractor setButtons = (CSelfExtractor)GetParent(); setButtons->SetWizardButtons(PSWIZB_NEXT | PSWIZB_FINISH | PSWIZB_CANCEL);

return CExtractorFinalUIDlg::OnSetActive();

}

Was it helpful?

Solution

In the constructor of your propertysheet, insert

m_psh.dwFlags |= PSH_NOAPPLYNOW;

The m_psh is of type PROPSHEETHEADER, you can set a lot of things.

OTHER TIPS

The actual cause of the stack overflow is that you call CExtractorFinalUIDlg::OnSetActive() in the CExtractorFinalUIDlg::OnSetActive(). So the function calls itself recursively. This leads to the stack overflow.

The function could be something like:

BOOL CExtractorFinalUIDlg::OnSetActive() {
     CPropertySheet* sheet = (CPropertySheet*) GetParent();
     ASSERT(sheet);
     // Combination of PSWIZB_NEXT and PSWIZB_FINISH might be useless
     sheet->SetWizardButtons(PSWIZB_NEXT | PSWIZB_FINISH | PSWIZB_CANCEL)

     return CPropertyPage::OnSetActive();
}

Look up MSDN: CPropertySheet::SetWizardButtons for more infos.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top