ICcServer::GetConnection (Windows CE 5.0)

Send Feedback

This method returns a pointer to the ICcConnection object for a specified target device.

HRESULT GetConnection(  ICcDevice* piDevice,  DWORD dwTimeout,  ICcServiceCB* piCallback,  BSTR* pbstrConnectionId,  ICcConnection** piTargetDevice);

Parameters

  • piDevice
    [in] A pointer to a valid ICcDevice that identifies the device to connect. This is normally retrieved from the datastore.

  • dwTimeout
    [in] Timeout in milliseconds for connect to complete if piCallback value is set to NULL.

    If the connection is not created within the specified timeout, the method returns failure.

    If piCallback value is set to non-NULL, this parameter is ignored.

  • piCallback
    [in] Pointer to the callback interface passed in by the clients.

    If this is a valid pointer, the method returns immediately and the caller is informed when the connection is created via callback interfaces ICcServiceCB.

    If this is NULL, the method blocks for dwTimeout milliseconds waiting for connection to be created.

  • pbstrConnectionId
    [out] Pointer to a connection ID that can be used to identify this connection.

  • piTargetDevice
    [out, retval] Out parameter pointing to the ICcConnection object.

    This is NULL if there is a failure, or if the call is an asynchronous call.

Return Values

If the method fails, it returns an HRESULT error code. Otherwise, the method returns one of the following values.

Value Description
S_OK Indicates success.
E_INVALIDARG Indicates invalid input arguments.
E_PENDING Indicates the connection could not be created within the given timeout.
E_FAIL Indicates any other failure.

Remarks

To establish a connection, the user must call ICcConnection::Connect.

Requirements

OS Version: Windows 2000, Windows XP Home, Windows XP Pro, Windows Server 2003, and Windows Server 2003 Service Pack 1.
Header: CcServer.h.
Link Library: none.

See Also

Core Connectivity Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.