Step Two: Adding an Object

After completing Step 1 of this tutorial, you can compile the files that Microsoft® Visual C++® creates for you into a dynamic-link library (DLL). To make this DLL useful, however, you must add support for an object that implements the appropriate pipeline interfaces.

When you use the Pipeline Component Wizard to add an object to your project, the IPipelineComponent interface is implemented by default. In addition, you can choose to implement the ISpecifyPropertyPages, IPersistStreamInit, and IPipelineComponentDescription interfaces.

To add an object to the MinMaxShip Sample
  1. On the Insert menu, click New ATL Object to display the ATL Object Wizard.

  1. In the first ATL Object Wizard dialog box, click Commerce Component as the category of object you want to add to your project. Click Next.

    A set of property pages is displayed to allow you to configure the control you are inserting into your project.

  2. In the Short Name box, type MinMaxShipping. (Do not click OK until configuring the second tab.) The other controls are filled in for you, so that the dialog box now looks like this.

The Class field shows the C++ class name created to implement the control. The .H File and .CPP File show the files created to contain the definition of the C++ class. The CoClass is the name of the component class for the object, and Interface is the name of the interface on which the component will implement its custom properties. The Type is a description for the control, and the ProgID is the readable name that can be used to look up the class ID (CLSID) of the control. Click OK.

  1. Click the Commerce Component tab. This tab displays a list of the optional interfaces that you can implement on a Commerce Server pipeline component.

If your component uses property pages to allow users to set component properties, you should implement ISpecifyPropertyPages. If your component saves and loads its properties to and from a stream, you should implement IPersistStreamInit. If you want your component users to identify the OrderForm, Transport Dictionary, or pipe context values that your component reads and writes, click IPipelineComponentDescription.

The MinMaxShip sample implements all of these interfaces, so you should select all of the check boxes on this tab, and then click OK.

The Pipeline Component Wizard creates the definition and implementation files that implement the necessary pipeline interfaces, and adds these files to the MinMaxShip project.

In addition, the wizard creates a stub implementation for the IMinMaxShipping interface, on which you implement your component’s properties (see Step 3: Adding Properties).

Note

The approach to adding properties illustrated in this section assumes that you do not intend to implement the IPipelineComponentAdmin interface. This interface is defined by Commerce Server as an alternative way to implement properties on an object (see Deciding Which Interface to Expose).


© 1997-1998 Microsoft Corporation. All rights reserved.