Export (0) Print
Expand All
Expand Minimize

CreateRandomAccessStreamOverStream function

Creates a Windows Runtime random access stream around an IStream base implementation.


HRESULT STDAPI CreateRandomAccessStreamOverStream(
  _In_   IStream *stream,
  _In_   BSOS_OPTIONS options,
  _In_   REFIID riid,
  _Out_  void **ppv


stream [in]

The COM stream to encapsulate.

options [in]

One of the BSOS_OPTIONS options that specify the behavior of the RandomAccessStream that encapsulates stream.

riid [in]

A reference to the IID of the interface to retrieve through ppv, typically IID_RandomAccessStream.

ppv [out]

When this method returns successfully, contains the interface pointer to the RandomAccessStream that encapsulates stream requested in riid.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Use the CreateRandomAccessStreamOverStream function to create a RandomAccessStream that encapsulates a COM IStream.

For info on utility classes that help with interoperation between Windows Runtime and COM streams, see the Remarks at RandomAccessStreamOverStream.

We recommend that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riid and ppv parameters. This macro provides the correct IID based on the interface pointed to by the value in ppv, which eliminates the possibility of a coding error in riid that could lead to unexpected results.

Windows Phone 8.1: This API is supported.


Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]



See also




Community Additions

© 2014 Microsoft