Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting avi file to play without changing filename path in code

Status
Not open for further replies.

dilawardesosa

Technical User
Apr 22, 2005
9
GB
Hi (apologies to author of code i dont remember who wrote it) the code ive found is really good allows me to play any avi file in access form as shown below

MODULE CODE
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

ANDTHIS IS FORM CODE WHERE TWO BUTTONS HAVE PLAY AND STOP FUNCTION
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
what im trying to do is allow the user to play any avi file without going through the code and changing the file path
 
Something like this ?
FileName = InputBox("Enter a file name", "Play an AVI", "c:\MyMovie.avi")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
**
Something like this ?
FileName = InputBox("Enter a file name", "Play an AVI", "c:\MyMovie.avi")
**

So the directory (c:\MyMovie.avi) would point to the where the avi files were placed and by inputting the name of the file it would play that one accroding (assuming the spelling was correct)??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top