We help IT Professionals succeed at work.

Help button on PropertySheet.

lonicekm asked
I have some PropertySheet in my DLL. How can I remove help button from it? "m_psh.dwFlags &= ~(PSH_HASHELP);" doesn't work there (in DLL)! Is there only one possibility - remove it and change other buttons' position and dialog size manually?
Watch Question

Try this:

CWnd* pHelpButton = GetDescendantWindow(IDHELP);
if ( pHelpButton  )

Leave rest of the buttons where they are because it is there standard position
BTW "Help" button is not shown by default so you must be adding it somewhere.

Hi lonicekm,
Have you tried:


from inside of your CYourPropertySheet class, e.g. during OnInitDialog ?

I found it. MFC adds that button for you if you have "ID_HELP" handler enabled. You will have to disable that handler and handle that message in OnCmd() manually or something like that. See MFC source

void CPropertyPage::CommonConstruct(LPCTSTR lpszTemplateName, UINT nIDCaption)
     if (AfxHelpEnabled())
          m_psp.dwFlags |= PSP_HASHELP;

BOOL AFXAPI AfxHelpEnabled()
     if (AfxGetApp() == NULL)
          return FALSE;

     // help is enabled if the app has a handler for ID_HELP

     // check main window first
     CWnd* pWnd = AfxGetMainWnd();
     if (pWnd != NULL && pWnd->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info))
          return TRUE;

     // check app last
     return AfxGetApp()->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info);

And do not forget to remove PSH_HASHELP on property sheet


Yes, that's right. When I use property sheet from DLL it shows only OK and Cancel button, but when I use property sheet from application (declared in app) it shows Apply and Help buttons too! I didn't expect this difference in behaviour of sheet. And when I wanted to use code for hiding of these buttons in DLL like in app it shows me help button! So no own code is necessary in DLL.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.