## IFilterGraph2 Interface

The IFilterGraph2 interface adds new functionality to the IGraphBuilder and IFilterGraph interfaces. It inherits from both interfaces and exposes all their methods. This interface also includes a method to add a source for a moniker, and an improved version of the IFilterGraph::Reconnect method. For this reason, you should usually use IFilterGraph2 instead of the other two.

When to Implement

The filter graph implements this interface so it isn't intended that you implement it.

When to Use

Use this interface in applications that previously called IFilterGraph::Reconnect and in applications that need a source filter for a moniker.

Methods in Vtable Order

IUnknown methods | Description
QueryInterface | Retrieves pointers to supported interfaces.
AddRef | Increments the reference count.
Release | Decrements the reference count.

IFilterGraph methods | Description
AddSourceFilterForMoniker | Adds a source for a moniker.
ReconnectEx | Specifies a pin and a media type to reconnect with.

###

IFilterGraph2::AddSourceFilterForMoniker

IFilterGraph2 Interface

Adds a source for a moniker.

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

##### Parameters

pMoniker
  [in] Pointer to an IMoniker interface.
pCtx
  [in] Pointer to an IBindCtx bind context interface.
lpcwstrFilterName
  [in] Pointer to the filter's name.
ppFilter
  [out] Address of a pointer to an IBaseFilter interface.

##### Return Values

Returns an HRESULT value that depends on the implementation of the interface.

##### Remarks

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.

###

IFilterGraph2::ReconnectEx

IFilterGraph2 Interface

Specifies a pin and a media type to reconnect with.

HRESULT ReconnectEx(
IPin * ppin,
const AM_MEDIA_TYPE *pmt );

##### Parameters

ppin
  [in] Pin to disconnect and reconnect.
pmt
  [in] Media type to reconnect with. Specify NULL to use the existing media type.

##### Return Values

Returns an HRESULT value that depends on the implementation of the interface.

##### Remarks

Like the IFilterGraph::Reconnect method, the ReconnectEx method schedules a reconnection of the pin with the pin it is currently connected to. By specifying a media type when this method is called, the pins don't have to check what type they were originally connected with or enumerate possible new types. This makes the reconnection more likely to succeed.

##### See Also

IFilterGraph::Reconnect

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