Wednesday, July 20, 2011

Remove Apply and Help Button in PropertySheets MFC

Add these 3 lines in CPropertysheet constructors:

this->m_psh.dwFlags &= ~PSH_HASHELP;
this->m_psh.dwFlags |= PSH_NOAPPLYNOW;
this->m_psh.dwFlags |= PSH_NOCONTEXTHELP;

the above line will disable Apply button but not Help button.

To remove Help button:
CTabHelper is your Class name:

BOOL CTabHelper::OnInitDialog()
{
    CPropertySheet::OnInitDialog();
    CButton *btnHelp;

    btnHelp = reinterpret_cast<CButton *>(GetDlgItem(IDHELP));
    btnHelp->DestroyWindow();

    return TRUE;
}

Hope this helps you cheers......