IMFTimer::SetTimer method (mfidl.h)

Sets a timer that invokes a callback at the specified time.

Syntax

HRESULT SetTimer(
  [in]  DWORD            dwFlags,
  [in]  LONGLONG         llClockTime,
  [in]  IMFAsyncCallback *pCallback,
  [in]  IUnknown         *punkState,
  [out] IUnknown         **ppunkKey
);

Parameters

[in] dwFlags

Bitwise OR of zero or more flags from the MFTIMER_FLAGS enumeration.

[in] llClockTime

The time at which the timer should fire, in units of the clock's frequency. The time is either absolute or relative to the current time, depending on the value of dwFlags.

[in] pCallback

Pointer to the IMFAsyncCallback interface of a callback object. The caller must implement this interface. The callback's Invoke method is called at the time specified in the llClockTime parameter.

[in] punkState

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.

[out] ppunkKey

Receives a pointer to the IUnknown interface of a cancellation object. The caller must release the interface. To cancel the timer, pass this pointer to the IMFTimer::CancelTimer method. This parameter can be NULL.

Return value

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

Return code Description
S_OK
The method succeeded.
MF_E_SHUTDOWN
The clock was shut down.
MF_S_CLOCK_STOPPED
The method succeeded, but the clock is stopped.

Remarks

If the clock is stopped, the method returns MF_S_CLOCK_STOPPED. The callback will not be invoked until the clock is started.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header mfidl.h
Library Mfuuid.lib

See also

IMFTimer