PRB: MFC Subclassed Static Control Does Not Work in VB5 (186472)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 5.0
This article was previously published under Q186472 SYMPTOMS
When an MFC control that subclasses a Static Window class is placed on a
Visual Basic form, two unexpected behaviors occur:
- The MFC ActiveX control does not respond to Windows messages, such as
WM_LBUTTONDOWN.
- When you double-click the control while the Visual Basic client is in
run-time mode, the control's Property Page dialog box appears.
RESOLUTION
To work around this problem, add a message handler for WM_NCHITTEST: - Open the Control Workspace (.dsw) file in Developer Studio.
- Use the Class wizard to add a message handler for WM_NCHITTEST. Edit the code to return HTCLIENT. Change your code to look like the following:
UINT CMySubClCtrl::OnNcHitTest(CPoint point)
{
// TODO: Add your message handler code here and/or call default.
//Return COleControl::OnNcHitTest(point);
return HTCLIENT;
}
- Rebuild the control.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 12/10/2003 |
---|
Keywords: | kbCtrl kbCtrlCreate kbinterop kbpending kbprb KB186472 |
---|
|