IMediaEvent::WaitForCompletion method (control.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The WaitForCompletion method waits for the filter graph to render all available data. The filter graph must be running or the method fails.

Syntax

HRESULT WaitForCompletion(
  [in]  long msTimeout,
  [out] long *pEvCode
);

Parameters

[in] msTimeout

Time-out interval, in milliseconds. Pass zero to return immediately. Pass the value INFINITE to block indefinitely.

[out] pEvCode

Pointer to a variable that receives an event code. See Remarks for more information.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
S_OK
Success.
E_ABORT
Time-out expired.
VFW_E_WRONG_STATE
The filter graph is not running.

Remarks

This method blocks until the time-out expires, or one of the following events occurs:

During the wait, the method discards all other event notifications.

If the return value is S_OK, the pEvCode parameter receives the event code that ended the wait. When the method returns, the filter graph is still running. The application can pause or stop the graph, as appropriate.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header control.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

IMediaEvent Interface