|
-
August 27th, 2009, 07:21 AM
#2
Re: playing sounds...
What kind of sound do you want to play?
For wave *.wav, use System.Media.SoundPlayer
Code:
Dim player As New System.Media.SoundPlayer("C:\song.wav")
player.Play()
For mp3, midi, wma, etc.. you may use the mciSendString API
Code:
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Use the following code to open and play
mciSendString("Open ""C:\song.mp3"" Alias MySong", "", 0, 0)
mciSendString("Play MySong", "", 0, 0)
Use the following code the close
mciSendString("Close MySong", "", 0, 0)
The 'MySong' is user-defined alias, you can change to different name so that you can control multiple songs, or playing them at the same time!
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
|