I wanted to use a CPropertySheet based application for a project and I did not want those default OK, Cancel, Help and Apply buttons that come with a CPropertySheet class. Therefore, I destroyed those windows on OnInitDialog. Here is the code for reference:
BOOLCProductUI::OnInitDialog()
{
CPropertySheet::OnInitDialog();
CRect rect;
CButton *pTempBtn;
CButton SaveChanges;
pTempBtn = reinterpret_cast<CButton *>(GetDlgItem(IDHELP));
if (NULL != pTempBtn)
{
pTempBtn->GetWindowRect(&rect);
pTempBtn->DestroyWindow();
}
pTempBtn = reinterpret_cast<CButton *>(GetDlgItem(IDOK));
if (NULL != pTempBtn)
{
pTempBtn->DestroyWindow();
}
pTempBtn = reinterpret_cast<CButton *>(GetDlgItem(IDCANCEL));
if (NULL != pTempBtn)
{
pTempBtn->DestroyWindow();
}
pTempBtn = reinterpret_cast<CButton *>(GetDlgItem(ID_APPLY_NOW));
if (NULL != pTempBtn)
{
ScreenToClient(&rect);
pTempBtn->MoveWindow(rect);
pTempBtn->SetWindowText(_T("Save Changes"));
}
UpdateData(FALSE);
return TRUE;
}
CProductUI is a class of CPropertySheet.
However, when I compile the program using VC++2008 in Debug mode, I get a Debug Assertion Failed error message at the line
"CPropertySheet::OnInitDialog();"
Can anyone please shed some light on why this is happening?