MFStartup function (mfapi.h)
Initializes Microsoft Media Foundation.
HRESULT MFStartup( ULONG Version, DWORD dwFlags );
Version number. Use the value MF_VERSION, defined in mfapi.h.
This parameter is optional when using C++ but required in C. The value must be one of the following flags:
||Do not initialize the sockets library.|
||Equivalent to MFSTARTUP_NOSOCKET.|
||Initialize the entire Media Foundation platform. This is the default value when dwFlags is not specified.|
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
||The method succeeded.|
||The Version parameter requires a newer version of Media Foundation than the version that is running.|
||The Media Foundation platform is disabled because the system was started in "Safe Mode" (fail-safe boot).|
||Media Foundation is not implemented on the system. This error can occur if the media components are not present (See KB2703761 for more info).|
An application must call this function before using Media Foundation. Before your application quits, call MFShutdown once for every previous call to MFStartup.
MFStartup should be called during should be called during app initialization and not from static constructors during process initialization.
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.
hr = MFStartup(MF_VERSION);
|Minimum supported client||Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2008 [desktop apps | UWP apps]|