Click to See Complete Forum and Search --> : MMcontrol1


Drew
April 15th, 2001, 12:01 AM
I have this code in my main form load procedure to play a media file:

MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "AVIVideo"
MMControl1.FileName = App.Path & "\video3.avi"
MMControl1.AutoEnable = True

' Open the MCI WaveAudio device.
MMControl1.Command = "Open"
MMControl1.Command = "Play"

I have to click on the play button to get it to play. How can I change the code to play after the form loads without clicking on the play button and how can I change the code to unload the media file when it is done playing?

Jason Bennison
April 15th, 2001, 05:52 AM
I had to do this for a computer game back in 1996 using Visual Basic 4/32

Flip (object) is the name of the splash window, and it starts playing a MIDI file called. 0.mid in its own accord when the program itself starts.

This is a copy and paste of the code I used, and it came before any other code was executed in the startup process of the game. Put this in the Private Sub Form_Load() event.

With Flip.MMControl1
.Shareable = false
.Visible = false
.DeviceType = "Sequencer"
.Command = "close"
.FileName = "0.mid"
.Command = "Open"
.Command = "play"
End With
With Flip.MMControl1
.Shareable = false
.DeviceType = "Sequencer"
.Visible = false
End With



I dont remember how I arrived at this method in doing it, but I do reacll it was a lot of messing about in getting it working.

HTH
Jason