BUG: Application Error Deleting VB ActiveX Control From ActiveX Control Test Container (236138)
The information in this article applies to:
- 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
This article was previously published under Q236138 SYMPTOMS
Under Windows NT, when deleting a Visual Basic 5.0 or Visual Basic 6.0 UserControl sited in the ActiveX Control Test Container, the following Application Error might occur:
The instruction at "0x0041842c" referenced memory at "0x00000000". The memory could not be "read"
CAUSE
This is caused by an errant WM_SETCURSOR message, which is sent after the DELETE key has been pressed to remove the control from the container. The code for the ActiveX Control Test Container (TSTCON32.EXE) does not check for a valid object before attempting to obtain a specific interface.
RESOLUTION
The source code for the ActiveX Control Test Container is located on the Visual Studio 6.0 MSDN CD in the "Samples\VC98\mfc\ole\tstcon" directory. The bug can be corrected by modifying the tcitem.cpp. Replace the HitTest method with the code below and recompile the tstcon project:
DWORD CTestContainer98Item::HitTest( CPoint point )
{
HRESULT hResult;
IViewObjectExPtr pViewObjectEx;
DWORD dwHitResult;
if( !m_rect.PtInRect( point ) )
{
// Trivially reject the point.
return( HITRESULT_OUTSIDE );
}
if (!m_lpObject) return( HITRESULT_OUTSIDE );
hResult = m_lpObject->QueryInterface( IID_IViewObjectEx,
(void**)&pViewObjectEx );
if( SUCCEEDED( hResult ) )
{
hResult = pViewObjectEx->QueryHitPoint( DVASPECT_CONTENT,
&m_rect, point, 0, &dwHitResult );
if( SUCCEEDED( hResult ) )
{
return( dwHitResult );
}
}
return( HITRESULT_HIT );
}
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 12/8/2003 |
---|
Keywords: | kbbug kbContainer kbpending KB236138 |
---|
|