MFScheduleWorkItemEx function (mfapi.h)

Schedules an asynchronous operation to be completed after a specified interval.


HRESULT MFScheduleWorkItemEx(
  [in]  IMFAsyncResult *pResult,
  [in]  INT64          Timeout,
  [out] MFWORKITEM_KEY *pKey


[in] pResult

Pointer to the IMFAsyncResult interface of an asynchronous result object. To create the result object, call MFCreateAsyncResult.

[in] Timeout

Time-out interval, in milliseconds. Set this parameter to a negative value. The callback is invoked after −Timeout milliseconds. For example, if Timeout is −5000, the callback is invoked after 5000 milliseconds.

[out] pKey

Receives a key that can be used to cancel the timer. To cancel the timer, call MFCancelWorkItem and pass this key in the Key parameter.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The function succeeded.


When the timer interval elapses, the timer calls MFInvokeCallback with the pResult pointer to invoke the asynchronous callback. The callback is specified when you create the result object.


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

See also


Media Foundation Functions

Work Queues