MFCreateFile function (mfapi.h)

Creates a byte stream from a file.

Syntax

HRESULT MFCreateFile(
  MF_FILE_ACCESSMODE AccessMode,
  MF_FILE_OPENMODE   OpenMode,
  MF_FILE_FLAGS      fFlags,
  LPCWSTR            pwszFileURL,
  IMFByteStream      **ppIByteStream
);

Parameters

AccessMode

The requested access mode, specified as a member of the MF_FILE_ACCESSMODE enumeration.

OpenMode

The behavior of the function if the file already exists or does not exist, specified as a member of the MF_FILE_OPENMODE enumeration.

fFlags

Bitwise OR of values from the MF_FILE_FLAGS enumeration.

pwszFileURL

Pointer to a null-terminated string that contains the file name.

ppIByteStream

Receives a pointer to the IMFByteStream interface of the byte stream. The caller must release the interface.

Return value

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

Remarks

This function is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header mfapi.h
Library Mfplat.lib
DLL Mfplat.dll

See also

Media Foundation Functions