Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95

View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?


"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP




Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Class: AVI32 in Category General VBA/VB6 : Multimedia from Total Visual SourceBook

Play AVI files using the MCI (media control interface) 32-bit Windows API for VB6 and 32 bit VBA.

This class allows you to interact with AVI movies without using the Microsoft Multimedia Control. This class also allows you to play movies on your form. With the Microsoft Multimedia Control you can only play movies in a separate window. It does not support Windows 64-bit VBA.

Procedure List

Procedure Name



(Declarations) Declarations Declarations and private variables for the CAVI32 class
FileName Property Get the file name of the AVI file to play.
Height Property Get the height of the playback window.
hWnd Property Get handle of the AVI window.
hWndParent Property Get the handle of the parent window. This property is only valid after calling the OpenAVI method.
Left Property Get the left position of the playback window in pixels, relative to the parent window.
Length Property Get the length of the AVI movie.
Position Property Get the current playback position.
Stretch Property Get the value of the stretch flag.
Top Property Set the top position of the playback window in pixels, relative to the parent window.
Width Property Get the width of the playback window.
Class_Terminate Terminate Close the AVI file.
CloseAVI Method Close the AVI file
OpenAVI Method Open the AVI file. This must be called before attempting to play the AVI file.
Pause Method Pause the playback.
Play Method Play the AVI file.
Rewind Method Rewind the movie.
StopPlay Method Stop the AVI player.
PositionMovieWindow Private Position the movie playback window. If stretch is True, then make the playback window the size indicated in the width and height properties. Otherwise modify it to the size of the movie starting at the left and top properties. All measurements are in pixels.

Example Code for Using Class: AVI32

' Example of the CAVI32 Class
' To try this example, do the following:
' 1. Create a new form
' 2. Add a command button called 'cmdPlay'
' 3. Add a command button called 'cmdStop'
' 4. Add a command button called 'cmdPause'
' 5. Add a command button called 'cmdRewind'
' 6. Add a check box called 'chkStretch'
' 7. Add an image control called 'ImgMovie'
' 8. Paste all the code from this example to the new form's module
' 9. Run the form

' This example assumes that the sample files are located in the folder named by the following constant.
Private Const mcstrSamplePath As String = "C:\TVSBSamp"

Private mclsAVI As CAVI32

Private Sub chkStretch_Click()
  mclsAVI.Stretch = (chkStretch = 1)
End Sub

Private Sub cmdPause_Click()
End Sub

Private Sub cmdPlay_Click()
End Sub

Private Sub cmdRewind_Click()
End Sub

Private Sub cmdStop_Click()
End Sub

Private Sub Form_Load()
  Set mclsAVI = New CAVI32

  cmdPlay.Caption = "Play"
  cmdStop.Caption = "Stop"
  cmdPause.Caption = "Pause"
  cmdRewind.Caption = "Rewind"

  ' Position movie
  mclsAVI.Left = ImgMovie.Left / Screen.TwipsPerPixelX
  mclsAVI.Top = ImgMovie.Top / Screen.TwipsPerPixelX
  mclsAVI.Width = ImgMovie.Width / Screen.TwipsPerPixelX
  mclsAVI.Height = ImgMovie.Height / Screen.TwipsPerPixelX

  ' Specify file
  mclsAVI.FileName = mcstrSamplePath & "\test.avi"

  ' Set the parent of the movie window
  mclsAVI.hWndParent = Me.hWnd

  ' Open movie

End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set mclsAVI = Nothing
End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources