lowingss
Jul 9th, 2002, 07:17 AM
How do I display an avi file while my program is loading???
ie. They click the icon to start the program--- avi is displayed and run until form is loaded, then form is displayed???
Any ideas?
Thanks
Shane
H-Zence
Jul 9th, 2002, 06:40 PM
Wazzup!
Though I'm a newbie here, I know a thing or two about this! I too had trouble getting VB to play the whole Cinema before skipping to the next routine in "Era of Sin", my company's first game. What you'll need to do is forget using any controls, such as the Windows Media Player control; from what I've been able to tell it just doesn't cut it. Here's the code for playing cinemtatic files such as .avi's or .mpg's:
-----------------------------------------------------------------------------------
' First we need to declare the API call
Private 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
Dim IntroDone As Boolean ' Has the intro passed?
Dim CurSub As Integer ' Keep track of the current subroutine
Dim Cin1Cmplt As Boolean ' Has the first cinema passed?
Private Sub Form_Load()
IntroDone = False ' Wait until the movie sequence is
' complete
DoIntro ' Show the game introductory sequence.
End Sub
Sub DoIntro()
' Current Subroutine
CURSUB = 1
' Declare basic variables
Dim returnstring As String
Dim FileName1 As String
Dim FileName2 As String
returnstring = Space(127)
' Avifile to play
' NOTE: The FileName should be the path of your AVI
If Cin1Cmplt = False Then
FileName1 = (App.Path & "\INTRO\001.AVI")
erg = mciSendString("open " & Chr$(34) & FileName1 & 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)
Sleep 5000
Cin1Cmplt = True
erg = mciSendString("close video", returnstring, 127, 0)
GoTo Complete
End If
' Cinema one complete
Complete:
If Cin1Cmplt = True Then
' EOS Intro
FileName1 = (App.Path & "\INTRO\002A.AVI")
erg = mciSendString("open " & Chr$(34) & FileName1 & 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)
Sleep 16000 ' adjust this to length of your AVI file
' The Intro is complete
IntroDone = True
' End the file
erg = mciSendString("close video", returnstring, 127, 0)
End If
End Sub
-----------------------------------------------------------------------------------
Hope this helps! If there are any questions just reply or E-Mail me, I understand it is confusing!
Always willing to help,
H-Zence