Share via


MSVidWebDVD Events

This topic applies to Windows XP Service Pack 1 or later.

The MSVidWebDVD object has various events associated with it. These events come in two types: those sent when a disc capability is disabled or enabled (Author-programmed events), and those sent by the filter graph manager, such as a domain change (Filter Graph events). Filter graph events are passed through the DVDNotify event.

All events are channeled through the MSVidCtl object and must be captured by subroutines in the code associated with the form hosting the Video Control.

Note  The MSVidWebDVD object must be declared using the WithEvents keyword if you wish to capture these events. This alerts Visual Basic that the MSVidWebDVD is exposing custom events.

Author-programmed events

Author-programmed events are events that the DVD author has programmed into the disc, usually enabling or disabling navigation features, such as pause, play chapter, or play title. These events can be used to enable or disable form controls appropriately. These events can be handled without further parsing as a subroutine declared in the following style:

Private Sub MSVidWebDVDobjectname_Eventname([ByVal parameters])

The following code demonstrates disabling a form pause button when the DVD author has disabled pause capability:

' Note: You must declare MSVidWebDVD using WithEvents to 
'      capture all sent events.
Dim WithEvents oDVDPlayer as MSVidWebDVD
Private Sub oDVDPlayer_PauseOn(ByVal bEnabled As Boolean)
   ' Enable or disable Pause button.
   cmdPause.Enabled = bEnabled
End Sub

Note  The MSVidWebDVD object must be declared using the WithEvents keyword if you wish to capture these events. This alerts Visual Basic that the MSVidWebDVD is exposing custom events.

Event parameters are sent by value, and must be written in exactly the same way as declared in the event definition, although the parameter names may be changed. An easy way to create event-capturing subroutines in the Microsoft® Visual Basic® development environment is to select the local name of the MSVidWebDVD object in the Object drop-down menu on the left, then choose the event name in the Procedure drop-down menu on the right. If the event does not already have a handling subroutine, one will be created for you with the proper name and parameters.

Filter graph events

Filter graph events typically concern playback or domain changes, such as angle changes, disc ejection, or playback stop, and are sent to the DVDNotify event. These can be used as notifications to refresh chapter or title lists, among other uses. The disc or DVD Navigator filter may send events at counterintuitive times, during setup, for example, so be sure to know when a disc sends particular messages before relying on them in your application.

These events are sent as integer values to the DVDNotify event, and require the message to be parsed before handling. The message is typically handled with If...Then or Case statements, similar to the way Windows messages are handled. A DVDNotify event code is accompanied by two parameters that may contain additional information about the event. The following code shows how some DVDNotify events might be handled:

Private Sub oVidWebDVD_DVDNotify(ByVal lEventCode As Long, _
            ByVal lParam1 As Variant, ByVal lParam2 As Variant)
Select Case lEventCode
    ' If in the FBI warning domain, disable inappropriate buttons.
    Case EC_DVD_DOMAIN_CHANGE
        If lParam1 = DVD_DOMAIN_FirstPlay Then
           cmdPause.Enabled = False
           cmdFastForward.Enabled = False
        End If
    Case EC_DVD_PARENTAL_LEVEL_CHANGE
        If lParam1 < oVidWebDVD.PlayerParentalLevel Then
           'Handle forbidden player level...
        End If
    'Handle other cases...
End Select

Note  Event code constants must be assigned manually. See Handling DVD Event Notifications for a list of event code values.

Event Description
ChangeCurrentAngle Sent when the disc enables or disables changing the angle.
ChangeCurrentAudioStream Sent when the disc enables or disables changing the audio stream.
ChangeCurrentSubpictureStream Sent when the disc enables or disables changing the subpicture stream.
ChangeKaraokePresMode Sent when the disc enables or disables changing the karaoke presentation mode.
ChangeVideoPresMode Sent when the disc enables or disables changing the video presentation mode.
DVDNotify Notifies an application of many different DVD events and disc instructions.
PauseOn Sent when the Pause command has been enabled or disabled. Ignored by MSVidCtl.
PlayAtTime Sent when the PlayAtTime command has been enabled or disabled.
PlayAtTimeInTitle Sent when the PlayAtTimeInTitle command has been enabled or disabled.
PlayBackwards Sent when the disc enables or disables play in a backward direction.
PlayChapter Sent when the PlayChapter command has been enabled or disabled.
PlayChapterInTitle Sent when the PlayChapterInTitle command has been enabled or disabled.
PlayForwards Sent when the disc enables or disables play in a forward direction.
PlayNextChapter Sent when the PlayNextChapter command has been enabled or disabled.
PlayPrevChapter Sent when the PlayPrevChapter command has been enabled or disabled.
PlayTitle Sent when the PlayTitle command has been enabled or disabled.
ReplayChapter Sent when the ReplayChapter command has been enabled or disabled.
Resume Sent when the Resume command has been enabled or disabled.
ReturnFromSubmenu Sent when the ReturnFromSubmenu command has been enabled or disabled.
SelectOrActivateButton Sent when the disc enables or disables the selection or activation of a menu button.
ShowMenu Sent when the disc enables or disables the showing of a menu.
StillOff Sent when the StillOff command has been enabled or disabled.
Stop Sent when the Stop command has been enabled or disabled. Ignored by MSVidCtl.

See Also

DVD Event Notification Codes
Handling DVD Event Notifications
MSVidWebDVD Object
MSVidWebDVDAdm Object
UOPValid

Send comments about this topic to Microsoft

Build date: 12/4/2008