DLL and Setup Functions

The Combase.h header file provides the following function for creating a run-time dynamic link with a specific dynamic-link library (DLL). For more information, read the Run-Time Dynamic Linking section in the Platform SDK.

LoadOLEAut32 Loads the Automation DLL (OleAut32.dll).

The Dllsetup.h header file provides the following functions for registering and unregistering Microsoft® DirectShow® filters. You'll typically call AMovieDllRegisterServer2 to register your filter. The other functions are either helper functions or provide backward compatibility.

AMovieDllRegisterServer Registers filters. Microsoft® ActiveMovie™ 1.0 only.
AMovieDllRegisterServer2 Registers and unregisters filters.
AMovieDllUnregisterServer Unregisters filters. ActiveMovie 1.0 only.
AMovieSetupRegisterFilter Registers a filter's merit, pins, and media types in the registry using the filter mapper. ActiveMovie 1.0 only.
AMovieSetupRegisterFilter2 Registers a filter's merit, pins, and media types in the registry using IFilterMapper2.

LoadOLEAut32

DLL and Setup Functions

Loads the Automation dynamic-link library (OleAut32.dll).

Syntax

HINSTANCE LoadOLEAut32( );

Return Value

Returns a handle to an Automation DLL instance.

Remarks

When the CBaseObject destructor destroys the object that loaded OleAut32.dll, it will unload the library if it is still loaded.

AMovieDllRegisterServer

DLL and Setup Functions

Registers filters. ActiveMovie 1.0 only.

Syntax

HRESULT AMovieDllRegisterServer(void);

Return Value

Returns an HRESULT value.

Remarks

Use AMovieDllRegisterServer2 rather than this function to set up (register) your filters unless you need compatibility with ActiveMovie 1.0 filters. For more information about AMovieDllRegisterServer2, see Register DirectShow Objects and the sample filters included with the Microsoft® DirectX® Media SDK.

AMovieDllRegisterServer2

DLL and Setup Functions

Registers and unregisters filters.

Syntax

HRESULT AMovieDllRegisterServer2(
    BOOL bRegister
);

Parameters

bRegister
TRUE indicates register the filter, FALSE indicates unregister it.

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise an error code is returned.

Remarks

Use this function to set up your filters. For more information, see Register DirectShow Objects and the sample filters included with the DirectX Media SDK.

Note  The filter registration process is changing to allow filters to register by category. For example, capture filters and compression filters are enumerated together in their respective categories. The following functions demonstrate how filter registration and unregistration by category might work. The AMCap sample demonstrates this procedure. The following function uses the IFilterMapper2 interface.

static const WCHAR *g_wszName = L"Sample Compressor Filter" ;

// register sample compressor filter
STDAPI
DllRegisterServer( void )
{

    // register the server
    HRESULT hr = AMovieDllRegisterServer2( TRUE );
    if( FAILED(hr) )
        return hr;

    IFilterMapper2 *pFm2 = 0;

    hr = CoCreateInstance( CLSID_FilterMapper2
                           , NULL
                           , CLSCTX_INPROC_SERVER
                           , IID_IFilterMapper2
                           , (void **)&pFm2 );
    
    if(FAILED(hr))
        return hr;

    static const AMOVIESETUP_MEDIATYPE sudAVICoTypeOut =  {
        &MEDIATYPE_Video,
        &MEDIASUBTYPE_SampleVideoType };

    static const AMOVIESETUP_MEDIATYPE sudAVICoTypeIn =  {
        &MEDIATYPE_Video,
        &GUID_NULL };

    static const AMOVIESETUP_PIN psudAVICoPins[] =
    {
        {
            L"Input"        // strName
            , FALSE         // bRendered
            , FALSE         // bOutput
            , FALSE         // bZero
            , FALSE         // bMany
            , &CLSID_NULL   // clsConnectsToFilter
            , 0             // strConnectsToPin
            , 1             // nTypes
            , &sudAVICoTypeIn } // lpTypes
        , { L"Output"       // strName
            , FALSE         // bRendered
            , TRUE          // bOutput
            , FALSE         // bZero
            , FALSE         // bMany
            , &CLSID_NULL   // clsConnectsToFilter
            , 0             // strConnectsToPin
            , 1             // nTypes
            , &sudAVICoTypeOut
        }
    };   // lpTypes     

    REGFILTER2 rf2;
    rf2.dwVersion = 1;
    rf2.dwMerit = MERIT_DO_NOT_USE;
    rf2.cPins = NUMELMS(psudAVICoPins);
    rf2.rgPins = psudAVICoPins;

    hr = pFm2->RegisterFilter(
        CLSID_SampleCompressorFilter,
        g_wszName,              // name shown to the user
        0,                      // device moniker
        &CLSID_VideoCompressorCategory,
        g_wszName,              // unique instance name
        &rf2);

    pFm2->Release();
 
    return hr;

}

// unregister sample compressor filter
STDAPI
DllUnregisterServer( void )
{

    HRESULT hr = AMovieDllRegisterServer2( FALSE );
    if( FAILED(hr) )
        return hr;

    IFilterMapper2 *pFm2 = 0;

    hr = CoCreateInstance( CLSID_FilterMapper2
                           , NULL
                           , CLSCTX_INPROC_SERVER
                           , IID_IFilterMapper2
                           , (void **)&pFm2       );
    
    if(FAILED(hr))
        return hr;

    hr = pFm2->UnregisterFilter(
        &CLSID_VideoCompressorCategory,
        g_wszName,
        CLSID_SampleCompressorFilter);

    pFm2->Release();
 
    return hr;
}

AMovieDllUnregisterServer

DLL and Setup Functions

Unregisters filters. ActiveMovie 1.0 only.

Syntax

HRESULT AMovieDllUnregisterServer(void);

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise, returns an error code.

Remarks

Use AMovieDllRegisterServer2 rather than this function to uninstall (unregister) your filters unless you need compatibility with ActiveMovie 1.0 filters. See Register DirectShow Objects and the sample filters included with the DirectX Media SDK for more information about AMovieDllRegisterServer2.

AMovieSetupRegisterFilter

DLL and Setup Functions

Registers a filter's merit, pins, and media types in the registry using the filter mapper. ActiveMovie 1.0 only.

Syntax

HRESULT AMovieSetupRegisterFilter(
    const AMOVIESETUP_FILTER const *psetupdata,
    IFilterMapper *pIFM,
    BOOL bRegister
);

Parameters

psetupdata
Pointer to the AMOVIESETUP_FILTER data.
pIFM
Pointer to IFilterMapper interface.
bRegister
Value indicating whether to register the filter; TRUE indicates register the filter, FALSE indicates unregister it.

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise, returns an error code.

Remarks

The CBaseFilter base class uses this helper function to register a filter if the 1.0 ActiveMovie run time is installed. It is provided for compatibility with ActiveMovie version 1.0 only.

Typically, a filter will use AMovieDllRegisterServer and will not call this function directly.

AMovieSetupRegisterFilter2

DLL and Setup Functions

Registers a filter's merit, pins, and media types in the registry using IFilterMapper2.

Syntax

HRESULT AMovieSetupRegisterFilter2(
    const AMOVIESETUP_FILTER const *psetupdata,
    IFilterMapper2 *pIFM2,
    BOOL bRegister
);

Parameters

psetupdata
Pointer to the AMOVIESETUP_FILTER data.
pIFM
Pointer to IFilterMapper2 interface.
bRegister
Value indicating whether to register the filter; TRUE indicates register the filter, FALSE indicates unregister it.

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise, returns an error code.

Remarks

AMovieDllRegisterServer2 uses this helper function to register a filter after the COM server has been registered.

Typically, a filter will use AMovieDllRegisterServer2 and will not call this function directly.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.