1

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();

}

kiddo
  • 1,596
  • 7
  • 31
  • 60
  • Could you show your CPropertySheet/CPropertyPage classes code? It's difficult to say just with this snapshot. In the snapshoot I can see that CSelfExtractor setButtons should be a pointer, but I suppose it's ok in your real code because it would not compile otherwise. – Javier De Pedro Dec 02 '09 at 07:30
  • tanx 4 ur reply Javier De Pedro,what u said was correct its actually a pointer..i made a mistake wen typing that...i will redefine the above function again... BOOL CPropertyPage::onsetActive() { CPropertySheet *setButtons = (CPropertSheet)GetParent(); setButtons->SetWizardButtons(PSWIZB_NEXT | PSWIZB_FINISH); return CExtractorFinalUIDlg::OnSetActive(); } is that clear now – kiddo Dec 02 '09 at 07:53
  • tanx 4 ur reply Javier De Pedro,what u said was correct its actually a pointer..i made a mistake wen typing that...i will redefine the above function again... BOOL CPropertyPage::onsetActive() { CPropertySheet *setButtons = (CPropertSheet)GetParent(); setButtons->SetWizardButtons(PSWIZB_NEXT | PSWIZB_FINISH); return CExtractorFinalUIDlg::OnSetActive(); } is that clear now – kiddo Dec 02 '09 at 07:53
  • Yes, this is clear. I can't see any problem in this code...but I would need to see the whole thing to know what's happening. Sorry but I can not help you without more information. – Javier De Pedro Dec 02 '09 at 10:02

2 Answers2

1

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.

sbecker
  • 553
  • 4
  • 12
0

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.

dwo
  • 3,576
  • 2
  • 22
  • 39