## Control Events

The ActiveMovie Control supports the following events.

Event | Description
DisplayModeChange | Indicates changes to the DisplayMode property.
Error | Indicates that an error occurred.
OpenComplete | Specifies the state of readiness for this ActiveMovie Control, based on how completely the source file has loaded.
PositionChange | Indicates changes to the current media position, such as when the user selects (or seeks to) a new media position.
ReadyStateChange | Indicates changes to the control's state of readiness.
StateChange | Indicates player state changes.
Timer | Handles timer events.

The ActiveMovie Control also supports several events common to other controls: Click, DblClick, KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, and MouseUp. For information about these events, see the event documentation for Visual Basic.

###

DisplayModeChange Event

Control Events

Indicates changes to the DisplayMode property, such as from full-screen to half.

Private Sub object_DisplayModeChange()

##### Remarks

The DisplayModeChange event is raised when the DisplayMode property changes. The current display mode appears in the DisplayMode property. State flags are listed under DisplayMode property.

###

Error Event

Control Events

Indicates that an error occurred.

Private Sub object_Error(ByVal SCode As Integer, ByVal Description As String, ByVal Source As String, CancelDisplay As Boolean)

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.
SCode
  Error code.
Description
  String describing the error that occurred.
Source
  String containing the ActiveMovie Control's name.
CancelDisplay
  Value that the client can set to cancel the default error messages.

##### Remarks

The Error event is sent when DirectShow reports an error during playback. By default, the ActiveMovie Control displays a message box containing the description string. To avoid displaying this box, set the CancelDisplay parameter of the Error event to False.

###

OpenComplete Event

Control Events

Indicates the control finished opening the media file and is ready for playback.

Private Sub object_OpenComplete()

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.

##### Remarks

This event is provided for backward compatibility; use the ReadyStateChange event instead.

###

PositionChange Event

Control Events

Indicates changes to the current media position, such as when the user selects (or seeks to) a new media position.

Private Sub object_PositionChange(ByVal oldPosition As Double, ByVal newPosition As Double)

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.
oldPosition
  Position before it changed, in seconds.
newPosition
  Current position, in seconds, after the position change occurred.

##### Remarks

Changes made directly to the CurrentPosition property do not trigger this event.

###

ReadyStateChange Event

Control Events

Indicates changes to the control's state of readiness.

Private Sub object_ReadyStateChange(ByVal ReadyState As Long)

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.
ReadyState
  Current state of readiness, after the change occurred.

##### Remarks

When you change the FileName property, applications should check the control's state of readiness before attempting to call the Run method on the newly opened file. Applications should call the Run method only if the ReadyState parameter equals amvInteractive or amvComplete.

Settings

Following are possible settings for the ReadyState parameter.

Setting | Value | Description
amvUninitialized | 1 | The FileName property has not been initialized.
amvLoading | 0 | The ActiveMovie Control is asynchronously loading a file.
amvInteractive | 3 | The control loaded a file, and downloaded enough data to play the file, but has not yet received all data.
amvComplete | 4 | All data has been downloaded.

###

StateChange Event

Control Events

Indicates that the player state changed, such as from running to stopped.

Private Sub object_StateChange(ByVal oldState As Long, ByVal newState As Long)

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.
oldState
  Previous state, before the change occurred.
newState
  Current state, after the change occurred.

##### Remarks

The ActiveMovie Control raises the StateChange event when the player state changes, such as from stopped to running. The current player state appears in the CurrentState property. You can find the player state flags in the CurrentState property documentation.

Settings

Following are possible settings for the oldState or newState parameters.

Setting | Value | Description
amvStopped | 0 | The player is stopped.
amvPaused | 1 | The player is paused.
amvRunning | 2 | The player is playing the multimedia file.

###

Timer Event

Control Events

Provides the rate at which DirectShow refreshes the control panel's display.

Private Sub object_Timer( )

##### Parameters

object
  Object expression that evaluates to an ActiveMovie Control.

##### Remarks

The Timer event is raised at the intervals specified by the control's timer.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.