Registering the ATL 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.

A globally unique identifier (GUID) identifies each stage in the pipeline. 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 class ID of the new component to the \HKEY_CLASSES_ROOT\CLSID\component_classid\implemented categories\stage_clsid registry key within 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 ATL Pipeline Component Wizard creates a skeleton DllRegisterServer routine for the component housing. Although this will register the component, several more keys need to be added to the registry so that the Pipeline Editor displays the component properly.

The Pipeline Editor looks under the Implemented Keys category in the registry to see if the object is a pipeline component and, if so, which stages it may appear in. The function RegisterCATID, provided in the Computil.cpp file, makes this registration easier. In addition, the name displayed for the component comes from the AuxUserType\2 key for the component. The RegisterName function handles this registration. The following is the complete DllRegisterServer routine:

STDAPI DllRegisterServer(void)
{
    HRESULT hr = S_OK;

    hr = _Module.RegisterServer(TRUE);

    if(FAILED(hr)) return hr;

    hr = RegisterCATID(CLSID_MinMaxShipping,
                       CATID_MSCSPIPELINE_COMPONENT);

    if(FAILED(hr)) return hr;

    hr = RegisterCATID(CLSID_MinMaxShipping,
                       CATID_MSCSPIPELINE_SHIPPING);

    if(FAILED(hr)) return hr;
    
    hr = RegisterName(CLSID_MinMaxShipping,L"MinMax.MinMaxShipping");
    if(FAILED(hr)) return hr;

    return hr;

}

See the Pipe_stages.h file for the constants for other pipeline stages and features.

See Also

Deciding Which Interface to Expose

Enhancing Component Usability

Implementing the IPipelineComponent Interface

Active Template Library

MinMaxShip Sample Pipeline Component


All rights reserved.