CBasePin.GetConnected method

The GetConnected method retrieves the pin connected to this pin.

Syntax


IPin* GetConnected();

Parameters

This method has no parameters.

Return value

Returns a pointer to the other pin's IPin interface.

Remarks

If the pin is not connected, this method returns NULL. Call the CBasePin::IsConnected method to determine whether the pin is connected.

The method does not call AddRef on the IPin interface, so the caller should not release the interface.

Examples

Because the reference count is not incremented on the returned pointer, you can chain method calls together:



if (m_MyPin->IsConnected())
{
    m_MyPin->GetConnected()->EndOfStream();
}


This coding pattern is very convenient; but as the example shows, you must be careful not to dereference a NULL pointer when the pin is unconnected.

Requirements

Header

Amfilter.h (include Streams.h)

Library

Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBasePin Class

 

 

Show: