MFScheduleWorkItem function (mfapi.h)

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

Syntax

HRESULT MFScheduleWorkItem(
  [in]  IMFAsyncCallback *pCallback,
  [in]  IUnknown         *pState,
  [in]  INT64            Timeout,
  [out] MFWORKITEM_KEY   *pKey
);

Parameters

[in] pCallback

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

[in] pState

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.

[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
S_OK
The function succeeded.

Remarks

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.

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

MFScheduleWorkItemEx

Media Foundation Functions

Work Queues