Partager via


ICcConnection::CreateStream (Compact 2013)

3/26/2014

Deprecated.

This method creates a byte stream based on a specified stream ID for transferring data to and from a device.

In Windows Embedded Compact 2013, CoreCon HLAPI has been deprecated.

Syntax

HRESULT CreateStream(
  BSTR bstrStreamId,
  DWORD dwTimeout,
  ICcServiceCB* piCallback,
  DWORD* pdwCookieId,
  ICcTransportStream** piStream
);

Parameters

  • bstrStreamId
    [in] Input stream identifier used for this stream.
  • dwTimeout
    [in] Timeout in milliseconds for connect to complete.

    If piCallback value is set to NULL and if the stream is not created within the specified timeout, then this API returns failure.

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

    Reserved. Any value returned in this parameter is ignored.

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

    If this is a valid pointer, then the API returns immediately and the ICcServiceCB interface sends notification to the caller is informed when the stream is created.

    If this is NULL, then the API blocks for dwTimeout while waiting for the stream to be created.

    Reserved. Any value returned in this parameter is ignored.

  • pdwCookieId
    [out] A valid cookie that identifies the call, if the API is called in an asynchronous mode (piCallback != NULL).

    Callers can use this cookie in calls to Abort().

    Reserved. Any value returned in this parameter is ignored.

  • piStream
    [out, retval] Pointer to the outgoing stream object.

    The stream object can be used to send raw bytes and to receive a byte stream from the device.

    If the method fails or if the call is an asynchronous call, piStream is NULL.

Return Value

If the method fails, it returns an HRESULT error code. If the method succeeds, it returns one of the following:

Value

Description

S_OK

Indicates the method call was successful.

E_INVALIDARG

Indicates an invalid stream id.

E_PENDING

Indicates that the stream could not be created within the given timeout. Users can try again with the same or a different timeout value. In this case, piStream is not pointing to any valid object.

E_DUPLICATE

Indicates that a connection stream object already exists for this device with the given stream ID.

E_OUTOFMEMORY

Indicates that the stream could not be created. Users might be able to free memory and retry the operation.

E_FAIL

Return value for any other failure

Remarks

bstrStreamId must match the stream ID values of a corresponding ICcTransport object created on the device.

If a stream by this ID already exists, the method returns E_DUPLICATE.

The format of bstrStreamId is a string containing one or more name-value pairs separated by spaces, as shown in the following example:

        name1=value1[ name2=value2...]
      

The underlying transport registered with the transport loader on the device determines the precise format of bstrStreamId.

The HLAPI calls IUnknown::AddRef on the ICcTransportStream interface returned by ICcConnection::CreateStream. The application must call ICcService::Disconnect and IUnknown::Release to free any resources associated with the transport stream.

Requirements

Header

ccconnection.h

See Also

Reference

ICcConnection
Core Connectivity Interfaces