MFStartup function (mfapi.h)
Initializes Microsoft Media Foundation.
Syntax
HRESULT MFStartup(
ULONG Version,
DWORD dwFlags
);
Parameters
Version
Version number. Use the value MF_VERSION, defined in mfapi.h.
dwFlags
This parameter is optional when using C++ but required in C. The value must be one of the following flags:
Value | Meaning |
---|---|
|
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. |
Return value
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code | Description |
---|---|
|
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). |
Remarks
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.
Do not call MFStartup or MFShutdown from work queue threads. For more information about work queues, see Work Queues.
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.
Examples
hr = MFStartup(MF_VERSION);
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | mfapi.h |
Library | Mfplat.lib |
DLL | Mfplat.dll |