|
-
Nov 14th, 1999, 11:13 PM
#1
Thread Starter
Hyperactive Member
how do you play music in VB? eg. How do you get a file to play, and how do you get it to stop.
Regards,
Alexander McAndrew
-
Nov 14th, 1999, 11:24 PM
#2
Addicted Member
You can use MS Multimedia Control.
Private Sub Form_Load ()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.DeviceType = "CDAudio"
MMControl1.Command = "Open"
End Sub
Private Sub Form_Unload (Cancel as Integer)
Form1.MMControl1.Command = "Close"
End Sub
------------------
smalig
[email protected]
smalig.tripod.com
-
Nov 15th, 1999, 03:54 AM
#3
Thread Starter
Hyperactive Member
thanks for replying! Unfortunatley though, I don't really understand what that does, and how I can choose what file to play. Also, what is MMControl1? I once saw some simple code that looked SOMETHING liked the following:
open "C:\whatever.wav" for something
something like that. Does that give you any ideas? Thanks for all of your help,
ALexander McAndrew
-
Nov 15th, 1999, 04:33 PM
#4
Addicted Member
The code from above for audio CD.
The Multimedia control allows you to manage Media Control Interface (MCI) devices. These devices include: sound boards, MIDI sequencers, CD-ROM drives, audio players, videodisc players, and videotape recorders and players.
Select References under the Project menu, and add a reference to the "Microsoft Multimedia Control" by checking the appropriate box.
If you want to play a wav file with MS Multimedia control you can use follow code. Add Microsoft CommonDialog Control, Microsoft Multimedia Control and Command Button to your form. Put this code to your form.
---------------
Private Sub Command1_Click()
On Error Resume Next
With CommonDialog1
.Filter = "Wav Files|*.wav"
.ShowOpen
If Err.Number = cdlCancel Then Exit Sub
MMControl1.FileName = .FileName
End With
MMControl1.Command = "Open"
End Sub
Private Sub Form_Load()
Command1.Caption = "Play"
With MMControl1
.Notify = False
.Wait = True
.Shareable = False
.DeviceType = "WaveAudio"
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
MMControl1.Command = "Close"
End Sub
---------------
Also you can play with API (look sample here).
------------------
smalig
[email protected]
smalig.tripod.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|