VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Easly play .avi files in your program, like the windows File Copy, Delete and many more! Use th

by Sam Witney (7 Submissions)
Category: Sound/MP3
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 21st December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Easly play .avi files in your program, like the windows "File Copy", "Delete" and many more! Use this code to create a simple AVI player of

API Declarations


'On your form, place a CommonDialog, a CommandButton and a Animation (called: commondialog1, command1 and animation1)
'Animation, and Common Dialog can be found in the tool bar, if you have Professional+ Form controls, if not look through the Components menu, (right click tool bar) and look for them there.


Rate Easly play .avi files in your program, like the windows File Copy, Delete and many more! Use th



On Error GoTo cancel
CommonDialog1.ShowOpen ' brings up the Open screen

On Error GoTo error
Animation1.open CommonDialog1.FileName ' opens the selected file, and biggins to play it - note, if you wish to only run an avi during an event, like file copy, only this line is needed, just replace "CommonDialog1.FileName" with your avi, like "c:\myavi.avi"

Exit Sub
error: MsgBox Err.Description, vbCritical, "Error Number " & Err.Number
cancel: ' if the user clicks cancel, the program does not open, it just leaves the sub
End Sub

Private Sub Form_Load()
Command1.Caption = "Load AVI" ' makes your button label correct
Animation1.AutoPlay = True ' ensures the selected avi plays when it is opened
CommonDialog1.CancelError = True ' makes the program follow the error goto if the user clicks cancel
End Sub


Download this snippet    Add to My Saved Code

Easly play .avi files in your program, like the windows File Copy, Delete and many more! Use th Comments

No comments have been posted about Easly play .avi files in your program, like the windows File Copy, Delete and many more! Use th. Why not be the first to post a comment about Easly play .avi files in your program, like the windows File Copy, Delete and many more! Use th.

Post your comment

Subject:
Message:
0/1000 characters