Previous in Contents Next in Contents

Step Eight: Registering the Component

Pipeline component registration involves identifying the component as a pipeline component, identifying the stage or stages with which the component has an affinity, and optionally registering its name and threading model.

Each stage in the pipeline is identified by a globally unique identifier (GUID). GUIDs are defined in the pipe_stages.h file, which you include in the implementation file in which you are registering a component.

To identify the stage or stages with which a component has an affinity, you write the new component's class ID to the \HKEY_CLASSES_ROOT\CLSID\component_classid\implemented categories\stage_clsid key win the Microsoft® Windows NT® Registry, where stage_class_id is the GUID of the stage with which the component will have an affinity, and where component_class_id is the class ID of the component itself.

The code with which you register your component should be invoked in the DLLRegisterServer routine that is created for you when you create the component project in Microsoft® Visual C++®.

The MinMaxShip sample component uses a function called RegisterCATID to register the MinMaxShip component as a pipeline component, and to identify the stage with which the component has an affinity. The RegisterCATID function is defined in computil.h, and is implemented in MinMaxShip computil.cpp file. Both of these files are included in the Microsoft® Commerce Server version 3.0 Software Development Kit (SDK).

To use the RegisterCATID function to register your component, simply copy these files into your component's project directory, and add the computil.cpp file to your project.

The following code, from the MinMaxShip sample component illustrates how to call RegisterCATID. This code registers MinMaxShip as a pipeline component, and then associates the component with the OPP's Accept stage:

hr = RegisterCATID(CLSID_MinMaxShipping, CATID_MSCSPIPELINE_COMPONENT);

if(FAILED(hr))
    return hr;

hr = RegisterCATID(CLSID_MinMaxShipping, CATID_MSCSPIPELINE_SHIPPING);

if(FAILED(hr))
    return hr;


© 1997-2000 Microsoft Corporation. All rights reserved.