How to delete the default Help button in CPropertySheet in MFC?
I am using CPropertySheet class for my design in MFC application,normally in CPropertySheet there would be 4 default buttons..I want to hide/delete the HELP button..I tried the following..but its not working/nither responding..I had this written in my CPropertyPage class is th开发者_开发问答ere any other way...
m_psh.dwFlags &= ~PSH_HASHELP;
The property pages also have a HASHELP
flag that needs to be cleared. The following code in the constructor of the property sheet should work:
// After the last AddPage() call:
m_psh.dwFlags &= ~PSH_HASHELP;
for(int i=0; i<GetPageCount(); ++i)
GetPage(i)->m_psp.dwFlags &= ~PSP_HASHELP;
Alternatively, one can also modify the m_psp
flag for each individual page before calling AddPage()
:
m_psh.dwFlags &= ~PSH_HASHELP;
page1.m_psp.dwFlags &= ~PSP_HASHELP;
AddPage(&page1);
// ...
http://msdn.microsoft.com/de-de/library/37k4h0bh(v=vs.80).aspx
You have to remove the flag from the sheet and all pages...
mySheet.m_psh.dwFlags &= ~PSH_HASHELP;
page1.m_psp.dwFlags &= ~PSP_HASHELP;
page2.m_psp.dwFlags &= ~PSP_HASHELP;
...
Take care of the difference: m_psh vs. m_psp and PSH_HASHELP vs. PSP_HASHELP
// Destroy the Help button
CButton *btnHelp;
btnHelp = reinterpret_cast<CButton *>(GetDlgItem(IDHELP));
btnHelp->DestroyWindow();
Go to your project's main cpp file (where theApp is defined).
Remove this line: ON_COMMAND(ID_HELP, CWinApp::OnHelp)
Aditya Palanki
This should work out :
Override the OnNotify method of the class derived from PropertySheet ,write the following code into it
CWnd *hwnd = GetDlgItem(IDHELP); hwnd->ShowWindow(SW_HIDE);
精彩评论