Article ID: 167961
Article Last Modified on 11/21/2006
//////////////////////////////////////
// HEADER file
class CMainFrame : public CMDIFrameWnd
{
afx_msg void OnHelp();
...
//////////////////////////////////////
// IMPLEMENTATION file
#include "afxpriv.h"
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
...
ON_COMMAND(ID_HELP, CMainFrame::OnHelp)
END_MESSAGE_MAP()
void CMainFrame::OnHelp()
{
if (m_dwPromptContext != 0)
{
if (m_dwPromptContext !=
HID_BASE_PROMPT + AFX_IDP_FAILED_TO_LAUNCH_HELP)
AfxGetApp()->WinHelp(m_dwPromptContext);
return;
}
// attempt to get help from whoever has the focus
HWND hWnd = ::GetFocus();
while (hWnd != NULL)
{
// attempt to process help
if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
return;
// check next parent/owner in the parent/owner chain
CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
if (pWnd != NULL)
hWnd = pWnd->GetOwner()->GetSafeHwnd();
else
// otherwise, return parent in the Windows sense
hWnd = ::GetParent(hWnd);
}
CWnd::OnHelp();
Keywords: kbbug kbdocview kbfix kbnoupdate kbvc400fix KB167961