Microsoft DirectX 9.0


The Connect method completes a connection to the output pin.


HRESULT Connect(
    IUnknown *pUnk,
    IMemAllocator *pAlloc,
    BOOL bSync



Pointer to the IUnknown interface of the output pin.


Pointer to the IMemAllocator interface of the input pin's preferred allocator, or NULL.


Boolean value that specifies whether to use synchronous reads. If TRUE, the pin performs synchronous read operations on the output pin. If FALSE, the pin makes asynchronous read requests.

Return Values

Returns an HRESULT. Possible values include the following.

Return code Description
S_OK Success.
VFW_E_ALREADY_CONNECTED The input pin is already connected.
E_NOINTERFACE The output pin does not expose IAsyncReader.


Call this method during the input pin's connection process. If the method fails, the pin should fail the connection.

This method queries the output pin for the IAsyncReader interface. If successful, it calls CPullPin::DecideAllocator to negotiate the allocator for the connection. If your input pin has a preferred allocator, specify it in the pAlloc parameter; the DecideAllocator method passes this pointer to the output pin's IAsyncReader::RequestAllocator method. Otherwise, set pAlloc to NULL.

If the value of bSync is TRUE, the CPullPin object makes synchronous read requests, by calling the output pin's IAsyncReader::SyncReadAligned. Otherwise, it calls the IAsyncReader::Request method to make overlapping read requests.

See Also