This is a very short article to show a solution for context sensitive help problem for a propertysheet embedded within the page of another propertysheet. The help command gets swallowed by the system and help is not shown.
While recently upgrading the help system for one of our applications from WinHelp to HTML help, we noticed that the context sensitive help of a propertysheet embedded in the page of another sheet was not being shown. After much tracing around through the MFC source and reading MSDN, I realized that when a propertysheet gets the
WM_HELPINFO message which is sent by
::IsDialogMessage(), it is not processed correctly due to the sheet having the window style of
Once I had identified the problem, the fix comes quite easily.
- Inherit your own class from
This class should be used to replace the existing embedded sheet object in your property page.
- Map the
This is the message we need to map to fix the problem.
afx_msg BOOL OnHelpInfo(HELPINFO * pHelpInfo);
BOOL CPropertySheetEx::OnHelpInfo(HELPINFO* pHelpInfo)
BOOL ret = FALSE;
bool handled = false;
if (GetStyle() & WS_CHILD)
CWnd * pWnd = GetParent();
while (pWnd != NULL && pWnd->GetStyle() & WS_CHILD)
pWnd = pWnd->GetParent();
if (pWnd != NULL)
ret = GetParent()->GetParent()->SendMessage(WM_HELP,
handled = true;
ret = CPropertySheet::OnHelpInfo(pHelpInfo);
And that's it, everything should now work correctly.