Cannot play Avi movies but plays avi animation?

wadstar

New member
Local time
Today, 06:33
Joined
Apr 28, 2005
Messages
6
I'm using sample code which i will paste below, it includes in the form a comman button, animation control and activeX control. it plays clipart files but when i try to play a movie inavi format such as a movie trailer it says it unable to open..what could i do to make allow all types of avi files.

Code:
       Private Sub cmd2_Click()
           With Cd2
              .Filter = "avi (*.avi)|*.avi"
              .ShowOpen
           End With
           With An2
              .AutoPlay = True
              .Open Cd2.fileName
           End With
        End Sub
this is sample code from msn website and works for clipart avi files but it seems not to open normal avi movies.

what would have to be done in order to allow any avi to play and or is there any other way i can play avi (any sort) on the form and which also allows me to choose any avi file (i.e from a table etc)

cheers in advance
 
Looking on from this i found some code which would allow me to play any avi file (thanks to the author, dont know name sorry)

but this plays any avi file with a full filepath name...have a look

Code:
'MODULE 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

this next code is for the form it includes two command buttons to allo play and stop functions.

Code:
Private Sub Command1_Click()
Dim returnstring As String
Dim FileName As String
returnstring = Space(127)
'Replace c:\MyMovie.avi with the AVI file you want to play
FileName = "c:\MyMovie.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

Private Sub Command2_Click()
erg = mciSendString("close video", returnstring, 127, 0)
End Sub

this stuff is really good, how can i adapt it so i could play any avi file of my choice without changing the filename as such (example open avi dialog menu etc)
 
Populate a listing of the avi files in a table so that the user can select the files of their choice from a combo box. In the combo boxes AfterUpdate event switch the avi file name to the one the user chooses.

Check this out for how to grab a listing of files from a directory... Browse [Find a directory or file]
 
Cool thats gr8 im gonna try it 2moro if i get stuck anywhere i'll give post up!
tanks again.
 
that is awesome your code is way brillaint, the select from tabel method is brillaint thansk to you and your sources.
 

Users who are viewing this thread

Back
Top Bottom