Microsoft DirectX 9.0

CBasePin::GetConnected

The GetConnected method retrieves the pin connected to this pin.

Syntax

IPin *GetConnected(void);

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.

Example Code

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.

See Also