Step 1: Decide on Designer Architecture

Before you start using the framework, you have to make some fundamental decisions about the architecture of your designer. For instance:

You should know the answers to these questions before creating your designer class.

To start, use ATL to create a full ActiveX control that has the following interfaces:

Interface Implementation
IOleObject IOleObjectImpl
IOleInPlaceObject IOleInPlaceObjectImpl
IOleInPlaceActiveObject IOleInPlaceActiveObjectImpl
IPersistStreamInit IPersistStreamInitImpl
IDispatch IDispatchImpl
IProvideClassInfo IProvideClassInfo2Impl
IConnectionPointContainer (optional) IConnectionPointContainerImpl
IViewObjectEx (optional) IViewObjectExImpl
IOleControl (optional) IOleControlImpl

Keep in mind the following requirements:

Next, you can add an event interface to the object. . Specify an event interface in the IDL file and add it as the default event interface of the object. Then modify the IProvideDynamicClassInfoImpl event template parameter to include the IID of the event interface.

At this point you have a control, not a designer. To add the registration, toolbox, and container features required in the designer, you have to derive from CComDesignerBase or one of its derived classes.

The example below shows a typical design-time object that implements no special features. Because the design-time object implements a separate run-time object, it inherits from the IProvideDynamicClassInfoImpl interface.

class ATL_NO_VTABLE CDiffDsgnCtl : 
   public CComObjectRootEx<CComSingleThreadModel>,
   public CComCoClass<CDiffDsgnCtl, &CLSID_DiffDsgnCtl>,
   public CComControl<CDiffDsgnCtl>,
   public IDispatchImpl<IDifferentDesigner, 
      &IID_IDifferentDesigner, &LIBID_DIFFDSGNLib>,
   public IProvideClassInfo2Impl<&CLSID_DiffDsgnCtl, 
      &DIID_DDifferentDesigner, &LIBID_DIFFDSGNLib>,
   public IPersistStreamInitImpl<CDiffDsgnCtl>,
   public IPersistStorageImpl<CDiffDsgnCtl>,
   public IQuickActivateImpl<CDiffDsgnCtl>,
   public IOleControlImpl<CDiffDsgnCtl>,
   public IOleObjectImpl<CDiffDsgnCtl>,
   public IOleInPlaceActiveObjectImpl<CDiffDsgnCtl>,
   public IViewObjectExImpl<CDiffDsgnCtl>,
   public IOleInPlaceObjectWindowlessImpl<CDiffDsgnCtl>,
   public IDataObjectImpl<CDiffDsgnCtl>,
   public IConnectionPointContainerImpl<CDiffDsgnCtl>,
   public IConnectionPointImpl<CDiffDsgnCtl, &DIID_DDifferentDesigner>,
   public IActiveDesignerImpl<CDiffDsgnCtl, 
      &CLSID_DifferentInstance, 
      ISUPPORT_IPERSISTSTREAMINIT | ISUPPORT_IPERSISTSTORAGE,
      RUNTIME_MISCSTATUS>,
   public IProvideDynamicClassInfoImpl<CDiffDsgnCtl, 
      &CLSID_DifferentInstance, &DIID_DifferentInstance,&LIBID_DIFFINSTLib>,
   public CComDesignerBase<CDiffDsgnCtl, RegEntryArray>
{   . . .
};

See Also

Step 2: Set up the Registration File