网站建设资讯

NEWS

网站建设资讯

VB.net如何播放音乐 vb播放mp3

vb.net怎么播放音乐文件

添加一个 WindowsMediaPlayer 控件 一句代码即可播放音乐 AxWindowsMediaPlayer1.URL = "音乐地址"

企业建站必须是能够以充分展现企业形象为主要目的,是企业文化与产品对外扩展宣传的重要窗口,一个合格的网站不仅仅能为公司带来巨大的互联网上的收集和信息发布平台,创新互联建站面向各种领域:成都人造雾成都网站设计成都营销网站建设解决方案、网站设计等建站排名服务。


VB.net里面怎么添加音乐

给你个 很简单的

Public Class Form1

Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

‘ 声明函数 mciexcute 加入库 winmm.all

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Call mciExecute("play E:\music\music\单身情歌.wma ")

'在 formload过程中 调用函数 mciexcute 里面 是 文件 路径

End Sub

End Class

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中如何播放声音,是要什么控件嘛?

My.Computer.Audio.Play("SoundFile.wav")

SoundFile.wav是你要播放的声音文件的路径

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如何播放音乐 vb播放mp3
URL分享:http://cdweb.net/article/dochhod.html