AllAPI Network - The KPD-Team

Allapi Network

 API List

API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
This Site
 Search Engine
 Contact Form

Donate to

Playing an AVI File

This tip demonstrates how to play an AVI video file without using the Multimedia (MCI) Control.

1. Add a basic module with following code

Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength _
As Long, ByVal hwndCallback As Long) As Long       

2. Add following code to Form1

Private Sub Form_Activate()
Dim returnstring As String
FileName As String 
returnstring = Space(127) 
'Avifile to play
FileName = "F:\Funstuff\Videos\Highperf\Welcome1.avi" 
erg = mciSendString("open " & Chr$(34) & FileName & _
Chr$(34) & " type avivideo alias video", returnstring, _
127, 0)
erg = mciSendString("set video time format ms", _
returnstring, 127, 0)
erg = mciSendString("play video from 0", returnstring, _
127, 0)
End Sub       

'It is important to close the video, even if the file to play has run out.  To close the video, use the following line of code:

erg = mciSendString("close video", returnstring, 127, 0)



Copyright © 1998-2007, The Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at