FIX: ATL Control Causes Access Violation In Visual Basic 5.0

Last reviewed: December 18, 1997
Article ID: Q167340
The information in this article applies to:
  • Microsoft Active Template Library, versions 2.0, 2.1
  • Microsoft Visual Basic Professional Edition for Windows, version 5.0

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:

   ARTICLE-ID: Q170365
   TITLE     : 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.

Keywords          : AtlControl AtlIss VS97FixlistSP3 kbinterop VS97FixlistSP2 VS97FixlistSP1
Technology        : kbAtl kbole kbInetDev
Version           : 5.0
Platform          : WINDOWS
Issue type        : kbprb
Solution Type     : kbfix kbservicepack


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.