FIX: ATL Control Causes Access Violation In Visual Basic 5.0 (167340)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 2.0
- The Microsoft Active Template Library (ATL) 2.1
- Microsoft Visual Basic Professional Edition for Windows 5.0
This article was previously published under Q167340 SYMPTOMS
Insert an ActiveX control created with the Active Template Library(ATL)
into Visual Basic 5.0. When you try to delete the control or run the Visual
Basic program, the following error message appears:
Unhandled exception in Vb5.exe: 0xC0000005: Access Violation.
CAUSE
The error message is caused by a bug in Visual Basic 5.0. When an ATL
control implements connection points and IQuickActivate, Visual Basic 5.0
causes an access violation if the control doesn't support
IPropertyNotifySink.
RESOLUTION
To get around this problem, you can do one of the following:
- Add the implementation of IPropertyNotifySink by deriving from
IPropertyNotifySinkCP and adding it to the connection point map:
// derive your control class from IPropertyNotifySinkCP
class CPolyCtl : public IPropertyNotifySinkCP<CPolyCtl>
{
...
}
// add IPropertyNotifySink to the connection point map
BEGIN_CONNECTION_POINT_MAP(CPolyCtl)
CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
END_CONNECTION_POINT_MAP()
-or- - Remove the implementation of IQuickActivate by removing it from the
control class' derivation list and COM map:
// delete these two lines
public IQuickActivateImpl<CPolyCtl>
COM_INTERFACE_ENTRY_IMPL(IQuickActivate)
STATUS
This problem has been corrected in Visual Studio 97 Service Pack 1.
For additional information about the Visual Studio 97 Service Pack 1,
please see the following article in the Microsoft Knowledge Base:
170365
INFO: Visual Studio 97 Service Packs - What, Where, and Why
REFERENCES
This issue is also documented in VCREAD.HTM, which comes with Visual C++
version 5.0.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbBug kbContainer kbCtrlCreate kbfix kbinterop kbVS97sp1fix kbVS97sp2fix KB167340 kbAudDeveloper |
---|
|