共用方式為


IMediaEvent::GetEvent

 
Microsoft DirectShow 9.0

IMediaEvent::GetEvent

The GetEvent method retrieves the next event notification from the event queue.

Syntax

  HRESULT GetEvent(
  long *lEventCode,
  LONG_PTR *lParam1,
  LONG_PTR *lParam2,
  long msTimeout
);

Parameters

lEventCode

[out] Pointer to a variable that receives the event code.

lParam1

[out] Pointer to a variable that receives the first event parameter.

lParam2

[out] Pointer to a variable that receives the second event parameter.

msTimeout

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

Return Values

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

Header: Declared in Control.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also