vb.net播放背景音乐 vbs播放音乐
怎样给vb.net程序中加背景音乐?简单点!!!
''''''''''' WAV/wma背景音乐
创新互联专业为企业提供岳阳县网站建设、岳阳县做网站、岳阳县网站设计、岳阳县网站制作等企业网站建设、网页设计与制作、岳阳县企业网站模板建站服务,十余年岳阳县做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As New Media.SoundPlayer
a.SoundLocation = "c:\windows.wav"
a.PlayLooping()
End Sub
End Class
VB.NET中播放背景音乐最简单的办法是什么啊?
给你我的程序,自己研究一下吧,我也不是很明白。
Public Class Form1
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal lpszSoundName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
Const SND_filename As Integer = H20000
Const SND_alias As Integer = H10000
Const SND_sync As Integer = H0
Declare Auto Function waveOutGetNumDevs Lib "winmm.dll" Alias "waveOutGetNumDevs" () As Integer
Declare Auto Function sndPlaySound Lib "winmm.dll" (ByVal filename As String, ByVal options As Integer) As Integer
Private Const SND_memory As Integer = H4
Private Const SND_async As Integer = H1
Private Const proess_domain As String = ""
Const SND_sync1 = H0
Const SND_async1 = H1
Const SND_nodefault = H2
Const SND_loop = H8
Const SND_nostop = H10
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Beep()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim strFileName As String = "start.wav"
PlaySound(strFileName, 0, SND_filename)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PlaySound("systemstart", 0, SND_alias Or SND_sync)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim ret As Long
Dim strfilename As String
strfilename = "start.wav"
ret = sndPlaySound(strfilename.ToCharArray, 0)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim i As Integer
i = waveOutGetNumDevs()
If i 0 Then
MsgBox("可以播放声音", 64, "检测")
Else
MsgBox("不能播放声音", 64, "检测")
End If
End Sub
End Class
怎么在vb.net程序里添加背景音乐?
推荐到一个人的百度空间里去看,
里面有DirectSound的教程
还有DirectInput、DirectDraw的教程
但是DirectSound只能播放wav
如果想播放像mp3、ogg之类的音乐,你可以使用AudioVideoPlayback
vb.net中如何播放声音,是要什么控件嘛?
My.Computer.Audio.Play("SoundFile.wav")
SoundFile.wav是你要播放的声音文件的路径
网站标题:vb.net播放背景音乐 vbs播放音乐
URL链接:http://myzitong.com/article/hgpded.html