SHCreateStreamOnFileA function

[SHCreateStreamOnFile is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use SHCreateStreamOnFileEx.]

Opens or creates a file and retrieves a stream to read or write to that file.

Syntax

LWSTDAPI SHCreateStreamOnFileA(
  LPCSTR  pszFile,
  DWORD   grfMode,
  IStream **ppstm
);

Parameters

pszFile

Type: LPCTSTR

A pointer to a null-terminated string that specifies the file name.

grfMode

Type: DWORD

One or more STGM values that are used to specify the file access mode and how the object that exposes the stream is created and deleted.

ppstm

Type: IStream**

Receives an IStream interface pointer for the stream associated with the file.

Return Value

Type: HRESULT

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

Remarks

SHCreateStreamOnFileEx fully supports all STGM modes and allows the caller to specify file attributes if creating a new file.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 5.0 or later)