The function uses the IEnumPins interface to loop through the pins on the filter. For each pin, it calls IPin::QueryDirection to determine the direction of the pin. If the direction matches, it calls the IPin::ConnectedTo method to test whether the pin is already connected to another pin.

The following code example uses this function to find an unconnected output pin on a filter: