Export (0) Print
Expand All

Handling DVD Event Notifications

The DVD Navigator sends notifications to an application-specified window when certain events take place, such as when the DVD domain changes, when a new parental management level is encountered, and when the DVD Navigator is about to enter an angle block. The event parameters can contain additional information related to the event. Error messages and warnings are also sent in this way. The application specifies the window that will handle the event notifications by using the IMediaEventEx pointer to call SetNotifyWindow, as follows:

hr = m_pIME->SetNotifyWindow(reinterpret_cast<OAHWND>(m_hWnd), WM_DVD_EVENT, 0);

In the preceding example, m_hWnd is the HWND of the window to receive the messages and WM_DVD_EVENT is the application-defined message (greater than WM_USER) that will signal that a DVD event has taken place. The event itself is retrieved by the application through a call to IMediaEvent::GetEvent. Because more than one event might be in the event queue at any given time, the application must call GetEvent within a loop that repeats until all queued events have been retrieved, as shown in the following code example.

while (SUCCEEDED(m_pIME->GetEvent(&lEvent, &lParam1, &lParam2, lTimeOut)))
    HRESULT hr;
    switch (lEvent)

            DVD_HMSF_TIMECODE *pTC = reinterpret_cast<DVD_HMSF_TIMECODE *>(&lParam1);
            m_CurTime = *pTC;
    } // switch

DVD events might contain additional information in the lParam1 or lParam2 parameters, as illustrated above where the current time is contained in lParam1. The preceding code example is from the DVD sample application in Dvdcore.cpp. For a complete list of all DVD events and their parameters, see DVD Event Notification Codes.

Related topics

DVD Applications



Community Additions

© 2014 Microsoft