PRB: MFC ActiveX Control with Subclassed ComboBox Does Not Drop Down Correctly in a VB Container (243454)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q243454 Note Microsoft Visual C++ .NET (2002) supports both the managed code
model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model. The information in this article applies only to
unmanaged Visual C++ code. SYMPTOMS An MFC ActiveX control with a subclassed ComboBox with the CBS_DROPDOWNLIST style, does not drop down correctly in a Visual Basic container.
The control drops down and immediately retracts; it drops down correctly only
if it is double-clicked. CAUSE The COleControl handlers for WM_LBUTTONDOWN and WM_LBUTTONUP call the SetCapture and ReleaseCapture functions, respectively. The call to ReleaseCapture in turn sends WM_CAPTURECHANGED notification, which in turn
causes the list box portion of the combo box to hide itself. RESOLUTION Create a message handler for the WM_MOUSEACTIVATE message
in your Control class. Call OnActivateInPlace in it:
int CCustomComboCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
OnActivateInPlace (TRUE, NULL);
return COleControl::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
Modification Type: | Major | Last Reviewed: | 9/23/2003 |
---|
Keywords: | kbComboBox kbContainer kbCtrl kbprb KB243454 kbAudDeveloper |
---|
|