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.
Function Description
LoadOLEAut32 Loads the Automation DLL (OleAut32.dll).

The Dllsetup.h header file provides the following functions for registering and unregistering DirectShow filters. You'll typically call AMovieDllRegisterServer2 to register your filter. The other functions are either helper functions or provide backwards compatibility.
Function Description
AMovieDllRegisterServer Registers filters. 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

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

HINSTANCE LoadOLEAut32( );

Return Values

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

Registers filters. ActiveMovie 1.0 only.

HRESULT AMovieDllRegisterServer(void);

Return Values

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. See Register DirectShow Objects and the sample filters included with the DirectShow SDK for more information about AMovieDllRegisterServer2.


AMovieDllRegisterServer2

Registers and unregisters filters.

HRESULT AMovieDllRegisterServer2(
  BOOL bRegister
  );

Parameters
bRegister
TRUE indicates register the filter, FALSE indicates unregister it.
Return Values

Returns an HRESULT value.

Remarks

Use this function to set up your filters. See Register DirectShow Objects and the sample filters included with the DirectShow SDK for more information.

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, which is not yet documented for this beta release.


// Register Sample Compressor Filter
STDAPI
DllRegisterServer( void )
{
 HRESULT hr = AMovieDllRegisterServer2( TRUE );
 if( FAILED(hr) )
     return hr;

 const WCHAR *wszUniq = L"Sample Compressor Filter" ;

 IFilterMapper2 *pFm2 = 0;

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

 hr = pFm2->RegisterFilter(
      CLSID_SampleCompressorFilter,
      wszUniq,
      0,
      &CLSID_VideoCompressorCategory,
      wszUniq,
      MERIT_DO_NOT_USE,
      NULL,
      0);

 pFm2->Release();
 
 return hr;
}

// Unregister Sample Compressor Filter
STDAPI
DllUnregisterServer( void )
{

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

const WCHAR *wszUniq = L"Sample Compressor Filter" ;

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,
     wszUniq,
     CLSID_SampleCompressorFilter);

pFm2->Release();
 
return hr;
}


AMovieDllUnregisterServer

Unregisters filters. ActiveMovie 1.0 only.

HRESULT AMovieDllUnregisterServer(void);

Return Values

Returns an HRESULT value.

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 DirectShow SDK for more information about AMovieDllRegisterServer2.


AMovieSetupRegisterFilter

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

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
TRUE indicates register the filter, FALSE indicates unregister it.
Return Values

Returns an HRESULT value.

Remarks

The CBaseFilter base class uses this helper function to register a filter if the 1.0 ActiveMovie runtime 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

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

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
TRUE indicates register the filter, FALSE indicates unregister it.
Return Values

Returns an HRESULT value.

Remarks

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

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

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.