How To Enable ActiveX Control Event Handling on a Web Page

Article translations Article translations
Article ID: 200839 - View products that this article applies to.
This article was previously published under Q200839
Expand all | Collapse all

SUMMARY

An ActiveX control must implement the IProvideClassInfo or IProvideClassInfo2 interface to enable event handling on a Web page. Microsoft Internet Explorer uses this interface to obtain the type library for the control and determine the available event set.

MORE INFORMATION

Using a script language, such as VBScript or JavaScript, a Web page author can use automation to invoke methods/properties and handle events for an ActiveX control placed on the page with an HTML <OBJECT> tag.

For an ActiveX control to support such event handling, it must implement the IProvideClassInfo or IProvideClassInfo2 interface. Internet Explorer queries the control for these interfaces and, if implemented, calls the GetClassInfo() method to obtain the type library for the control. Internet Explorer will initially query the control for IProvideClassInfo2 and, if this is not implemented, will then query for IProvideClassInfo.

The IProvideClassInfo2 interface is derived from IProvideClassInfo and provides an additional method, GetGUID(), which returns an object's outgoing interface ID for it's default event set.

For ActiveX controls developed using the Microsoft Foundation Classes, the IProvideClassInfo2 interface is implemented by default.

For ActiveX controls developed using Microsoft Visual Basic, the IProvideClassInfo interface is implemented by default.

When using the Microsoft Active Template Library (ATL), version 3.0, the following 'lite control' ATL objects do not implement the IProvideClassInfo2 interface by default:
  • Simple Object
  • Internet Explorer Object
  • Lite Control
  • Lite Composite Control
  • Lite HTML Control
You can easily add support for event handling by implementing the IProvideClassInfo interfaces. This is done by deriving your control from the default ATL implementation, IProvideClassInfo2Impl.

  1. Add the following line to your class derivation list:
       public IProvideClassInfo2Impl<&CLSID_<object_name>, NULL,
                                     &LIBID_<project_name>Lib>
    					
  2. Add the following lines to your COM_MAP:
       COM_INTERFACE_ENTRY(IProvideClassInfo)
       COM_INTERFACE_ENTRY(IProvideClassInfo2)
    					

REFERENCES

For more information about the Active Template Library and implementing ActiveX controls, please consult the Microsoft Visual C++ Online documentation.

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
http://msdn.microsoft.com/ie/

http://support.microsoft.com/iep
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Mark Davis, Microsoft Corporation.

Properties

Article ID: 200839 - Last Review: May 11, 2006 - Revision: 3.0
APPLIES TO
  • Microsoft Internet Explorer 3.0
  • Microsoft Internet Explorer 3.01
  • Microsoft Internet Explorer 3.02
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.5
  • Microsoft ActiveX Template Library 3.0
  • Microsoft Foundation Class Library 4.2
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbhowto kbinetdev kbctrlcreate kbfaq kbactivexevents KB200839

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com