Microsoft DirectX 9.0


The AddSourceFilterForMoniker method adds a source filter based on a moniker. For example, you can obtain a moniker for a system device, such as a video capture device, and add a video capture filter for that device. (For more information about system device monikers, see the ICreateDevEnuminterface.)


HRESULT AddSourceFilterForMoniker(
  IMoniker *pMoniker,
  IBindCtx *pCtx,
  LPCWSTR lpcwstrFilterName,
  IBaseFilter **ppFilter



[in] Pointer to an IMoniker interface.


[in] Pointer to an IBindCtx bind context interface.


[in] Pointer to the filter's name.


[out] Address of a variable that receives an IBaseFilter interface pointer.

Return Values

Returns and HRESULT value. Possible values include the following.

Value Description
S_OK Success.
VFW_S_DUPLICATE_NAME Success; but the specified name was a duplicate, so the Filter Graph Manager modified the name.
E_FAIL Failure.
E_OUTOFMEMORY Insufficient memory.
VFW_E_DUPLICATE_NAME Failed to add a filter with a duplicate name.
VFW_E_CANNOT_LOAD_SOURCE_FILTER The source filter for could not be loaded.
VFW_E_UNKNOWN_FILE_TYPE The media type of this file is not recognized.


When adding a source filter for the given moniker to the graph, the COM IMoniker::BindToStorage member function will query for an IStream interface. If this fails, IMoniker::BindToObject will try to retrieve an IBaseFilter interface.

See Also