Article ID: 145865
Article Last Modified on 11/21/2006
FixHelp(this);
/* Compile options needed: Default
*/
////////////////////////////////////////////////////////////////////////
// FixHelp.h - Include this file in your dialog's or form view's .CPP
void FixHelp(CWnd* pWnd); // Call this from your OnInitDialog() for a
// dialog or OnInitialUpdate() for a CFormView
////////////////////////////////////////////////////////////////////////
// FixHelp.cpp - Insert this file into your project
#include "stdafx.h"
LRESULT CALLBACK ControlFixProc( HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam);
void FixHelp(CWnd* pWnd)
{
// search all child windows. If their window proc
// is AfxWndProc, then subclass with our window proc
CWnd* pWndChild = pWnd->GetWindow(GW_CHILD);
while(pWndChild != NULL)
{
if (GetWindowLong(pWndChild->GetSafeHwnd(),
GWL_WNDPROC) == (LONG)AfxWndProc)
{
SetWindowLong(pWndChild->GetSafeHwnd(), GWL_WNDPROC,
(LONG)ControlFixProc);
}
pWndChild = pWndChild->GetWindow(GW_HWNDNEXT);
}
}
LRESULT CALLBACK ControlFixProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
if (uMsg == WM_HELP)
{
// bypass MFC's handler, message will be sent to parent
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return AfxWndProc(hwnd,uMsg,wParam,lParam);
}
////////////////////////////////////////////////////////////////////////
Additional query words: kbVC400bug 4.00 4.10 SubclassWindow SubclassDlgItem kbSweptVC600
Keywords: kbarchitecture kbbug kbfix kbnoupdate kbuidesign kbvc410fix KB145865