IMediaEvent.GetEventHandle
Microsoft DirectShow 9.0 |
IMediaEvent.GetEventHandle
- Note This topic is deprecated. It applies to Visual Basic 6.0. DirectShow is not supported for Visual Basic .NET or C#.
The GetEventHandle method retrieves a handle to a manual-reset event that remains signaled while the queue contains event notifications.
Syntax
objMediaEvent .GetEventHandle( ByRef hEvent As Long)
Parameters
hEvent
Variable that receives the event handle.
Return Values
This method does not return a value.
Remarks
The Filter Graph Manager keeps a manual-reset event that reflects the state of the event queue. If the queue contains event notifications, the manual-reset event is signaled. If the queue is empty, the IMediaEvent.GetEvent method resets the event. An application can use this event to determine the state of the queue.
To use this event in Visual Basic, your application must call into a Microsoft® Windows® function such as WaitForSingleObject or WaitForMultipleObjects. You must declare the function in a module, as shown in the example code. However, it might be easier in Visual Basic simply to create a timer and periodically call GetEvent.
Example Code
First declare the WaitForSingleObject and GetEvent methods in a module, as follows:
Public Const WAIT_ABANDONED& = &H80& Public Const WAIT_OBJECT_0& = 0 Public Const WAIT_OBJECT_1& = 1 Public Const WAIT_TIMEOUT& = &H102& Public Const INFINITE = &HFFFF Public Declare Function WaitForSingleObject Lib "kernel32" _ (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Declare Function CreateEvent _ Lib "kernel32" _ Alias "CreateEventA" _ (lpEventAttributes As Long, _ ByVal bManualReset As Long, _ ByVal bInitialState As Long, _ ByVal lpName As String) As Long
Then call GetEventHandle to retrieve the event handle, and use the WaitForSingleObject method to wait for the event to be signaled:
Dim hEvent As Long, wait_result As Long Dim EvCode As Long, Param1 As Long, Param2 As Long mEvent.GetEventHandle hEvent wait_result = WaitForSingleObject(hEvent, 1000) If wait_result = WAIT_OBJECT_0 Then On Error Resume Next Do mEvent.GetEvent EvCode, Param1, Param2, 0 If Err.Number = 0 Then ' Handle event. (Not shown.) mEvent.FreeEventParams EvCode, Param1, Param2 Loop While Err.Number = 0 End If Err.Clear
Requirements
Reference: Add a reference to ActiveMovie control type library.
Library: Quartz.dll.
See Also