Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

MFScheduleWorkItem function

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


HRESULT MFScheduleWorkItem(
  _In_   IMFAsyncCallback *pCallback,
  _In_   IUnknown *pState,
  _In_   INT64 Timeout,


pCallback [in]

Pointer to the IMFAsyncCallback interface. The caller must implement this interface.

pState [in]

Pointer to the IUnknown interface of a state object, defined by the caller. This parameter can be NULL. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.

Timeout [in]

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.

pKey [out]

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 codeDescription

The function succeeded.



This function creates an asynchronous result object. When the timer interval elapses, the IMFAsyncCallback::Invoke method specified by pCallback is called.

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.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]







See also

Media Foundation Functions
Work Queues



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.