IMediaEvent::GetEvent 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 GetEvent method retrieves the next event notification from the event queue.

Syntax

HRESULT GetEvent(
  [out] long     *lEventCode,
  [out] LONG_PTR *lParam1,
  [out] LONG_PTR *lParam2,
  [in]  long     msTimeout
);

Parameters

[out] lEventCode

Pointer to a variable that receives the event code.

[out] lParam1

Pointer to a variable that receives the first event parameter.

[out] lParam2

Pointer to a variable that receives the second event parameter.

[in] msTimeout

Time-out interval, in milliseconds. Use INFINITE to block until there is an event.

Return value

Returns an HRESULT value. Possible values include those shown in the following table.

Return code Description
S_OK
Success.
E_ABORT
Timeout expired.

Remarks

If no event is on the queue, this method waits up to msTimeout milliseconds for an event to arrive. Avoid using a time-out interval of INFINITE, because threads cannot process any messages while waiting in GetEvent. If you call GetEvent from the same thread that processes Windows messages, specify only small wait times, in order to remain responsive to user input.

After calling GetEvent, call the IMediaEvent::FreeEventParams method to release any resources allocated for the event parameters.

For a list of notification codes and event parameter values, see Event Notification Codes.

Because this method removes the event from the filter graph event queue, there is no way for multiple clients to monitor events from the same graph.

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

IMediaEventEx