Article ID: 148703 - Last Review: November 21, 2006 - Revision: 2.1 FIX: CWnd::SubclassDlgItem Returns FALSE for OLE ControlsThis article was previously published under Q148703 On This PageSYMPTOMS
Using CWnd::SubclassDlgItem to subclass an OLE Control returns FALSE,
after failing on the check for m_pCtrlCont != NULL in line 301 of
Winctrl1.cpp.
CAUSE
The MFC framework's implementation of CWnd::SubclassDlgItem checks and
uses the CWnd::m_pCtrlCont member of the OLE control, instead of the
control container, which is the parent of the control. The source code
should use pParent->m_pCtrlCont in order to access the container.
RESOLUTION
As a workaround, use CWnd::SubclassWindow instead of CWnd::SubclassDlgItem,
which is illustrated in the sample code section in this article.
STATUS
Microsoft has confirmed this to be bug in the Microsoft products listed at
the beginning of this article. This problem was corrected in Microsoft
Visual C++, 32-bit Edition, version 4.1.
MORE INFORMATIONSteps to Help Reproduce Problem
Sample Code to Work Around ProblemAPPLIES TO
| Article Translations
|

Back to the top
