Handling Design-Time Changes

At design time, an end user can add properties and methods to an ActiveX designer or remove them from the designer. When this occurs, your code has to change the existing type information and lay out the new type information.

The action you have to take depends on the kind of object you're working with. When you change the type information for a VTBL interface, you treat properties and methods as functions. Use the AddFuncDesc method of the ICreateTypeInfo interface to add a property or method, and DeleteFuncDesc (or DeleteFuncDescByMemId) in the ICreateTypeInfo2 interface to remove a property or method.

When you change the type information for a dispatch interface, you treat properties as variables and methods as functions. To add and remove properties, you use the AddVarDesc and DeleteVarDesc (or DeleteVarDescByMemId) methods. To add and remove methods you use the AddFuncDesc and DeleteFuncDesc (or DeleteFuncDescByMemId) methods.

Afterwards, you call ITypeInfo::LayOut, which assigns a dispatch identifier (DISPID) and a VTBL offset to the new subobject. A brief discussion of these methods follows; refer to the Automation Programmer's Reference for complete details.

Whenever your code adds or deletes a function or variable descriptor, Automation triggers an ITypeChangeEvents notification to the host. This notification makes the host aware that it should call the ActiveX designer's GetDynamicClassInfo method to get the new type information.