vbnet播放音乐,vbnet播放音乐和声音
vb.net怎么播放音乐文件
添加一个 WindowsMediaPlayer 控件 一句代码即可播放音乐 AxWindowsMediaPlayer1.URL = "音乐地址"
成都创新互联是一家集网站制作、网站设计、网站页面设计、网站优化SEO优化为一体的专业网站制作公司,已为成都等多地近百家企业提供网站建设服务。追求良好的浏览体验,以探求精品塑造与理念升华,设计最适合用户的网站页面。 合作只是第一步,服务才是根本,我们始终坚持讲诚信,负责任的原则,为您进行细心、贴心、认真的服务,与众多客户在蓬勃发展的市场环境中,互促共生。
vb.net 中 如何实现 播放mp3文件
在.NET里,没有托管的音乐播放器,用API只能播放WAV格式,对于MP3等形式的音频文件,就要依赖于其他控件了,常用的就是
MediaPlayer。使用方法:
在工具箱上点右键,选择“选择项目(Choose
Items)”,切到COM选项卡,找到
Windows
Media
Player,
勾选,确定
在t工具箱上,把刚才加入的MediaPlayer控件,拖放到窗体上
代码:
WindowsMediaPlayer1.URL
=
"mp3文件路径,支持网络路径"
WindowsMediaPlayer1.Ctlcontrols.play
基本就OK了,至于其他的操作诸如下一曲上一曲暂停停止,直接看
WindowsMediaPlayer1.Ctlcontrols.
里面的方法吧。
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中如何播放声音,是要什么控件嘛?
My.Computer.Audio.Play("SoundFile.wav")
SoundFile.wav是你要播放的声音文件的路径
网页题目:vbnet播放音乐,vbnet播放音乐和声音
网站地址:http://ybzwz.com/article/hohgcj.html