Microsoft KB Archive/167340

= FIX: ATL Control Causes Access Violation In Visual Basic 5.0 =

Article ID: 167340

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft ActiveX Template Library 2.0
 * Microsoft ActiveX Template Library 2.1
 * Microsoft Visual Basic 5.0 Professional Edition

-



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 {     ...      }      // 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 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

