Microsoft KB Archive/244487

= INFO: Control Extenders in the VBA SDK =

Article ID: 244487

Article Last Modified on 11/19/1999

-

APPLIES TO


 * Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 5.0
 * Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 6.0
 * Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK) 6.1

-



This article was previously published under Q244487



SUMMARY
When controls are added to a project item, Visual Basic for Applications (VBA) blends the control with a host-provided extender object that supplements the properties, methods, and events of the control. For hosts using the Application Programmability Component (APC), an extender object is not required. However, hosts using the basic VBA interfaces and those wishing to provide additional functionality to their controls must have the extender object.

This article describes the requirements and limitations of control extenders.



MORE INFORMATION
Control extenders can be implemented as dual interfaces or as dispinterfaces. The type information of a control extender must include the following properties and methods:
 * Name
 * Object
 * Parent
 * Index
 * Delete

These properties and methods should be declared with the STD_EXTENDER_METHODS macro in the extender object's IDL file, such as: dispinterface MyControlExtender {  STD_EXTENDER_METHODS } Name is a read/write property, Object and Parent are read-only properties, and Index and Delete are methods. For any of these properties or methods, the extender might choose to return DISP_E_MEMBERNOTFOUND. This indicates to VBA that the default implementation of the method or property should be used instead.

Controls and Extended Type Libraries
When a control and extender are added to a VBA project item, VBA aggregates the control and extender into a single entity. It also blends the type information of the control and the extender so the aggregate object behaves as a single unit. The blended type information is saved in a file with an .exd extension. If an .exd file already exists, VBA does not recreate it. When creating an .exd file, VBA scans the type library of the control looking for any CoClass that is marked as a control. This can be indicated by the [control] attribute in the type library. Alternatively, the Registry entry of the CoClass may be marked Control or Insertable. Each control in the type library gets merged with the current extender object, and the .exd file is saved out. All subsequent controls use the existing .exd file.

This implies several things.
 * Each control can only have one extender.
 * All controls in the same typelib get the same control extender.
 * Controls in different type libraries can have different extenders.

Additional query words: VBASDK

Keywords: kbinfo KB244487

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.