展开全部
工程→控件→windowsmediaplayer
引用后左边控件列表中会多出一个东西,点它,在屏幕上画个框,mediaplayer就到屏幕上啦
接下来,制作文件打开工具
放置
drive1
dir1
file1
三个控件。把file1的pattern属性设为*.wma
然后写入如下代码
private
sub
dir1_change()
file1.path
=
dir1.path
end
sub
private
sub
drive1_change()
dir1.path
=
drive1.drive
end
sub
private
sub
file1_click()
windowsmediaplayer1.url
=
file1.path
&
"\"
&
file1.filename
end
sub
url是文件的路径,你也可以抛弃那三个控件,直接指定一个文件
至于视频嘛,也一样,可以放一个command1
caption属性设为"视频"
private
sub
command1_click()
file1.pattern="*.avi"
end
sub
为了能改回来,放一个command2
caption属性设为"音频"
private
sub
command2_click()
file1.pattern="*.wma"
end
sub
附加:全屏法:
放一个command3
caption属性设为"全屏"
private
sub
command3_click()
windowsmediaplayer1.fullscreen
end
sub
引用后左边控件列表中会多出一个东西,点它,在屏幕上画个框,mediaplayer就到屏幕上啦
接下来,制作文件打开工具
放置
drive1
dir1
file1
三个控件。把file1的pattern属性设为*.wma
然后写入如下代码
private
sub
dir1_change()
file1.path
=
dir1.path
end
sub
private
sub
drive1_change()
dir1.path
=
drive1.drive
end
sub
private
sub
file1_click()
windowsmediaplayer1.url
=
file1.path
&
"\"
&
file1.filename
end
sub
url是文件的路径,你也可以抛弃那三个控件,直接指定一个文件
至于视频嘛,也一样,可以放一个command1
caption属性设为"视频"
private
sub
command1_click()
file1.pattern="*.avi"
end
sub
为了能改回来,放一个command2
caption属性设为"音频"
private
sub
command2_click()
file1.pattern="*.wma"
end
sub
附加:全屏法:
放一个command3
caption属性设为"全屏"
private
sub
command3_click()
windowsmediaplayer1.fullscreen
end
sub
展开全部
1.可以用API:
Private
Declare
Function
sndPlaySound
Lib
"Winmm.dll"
Alias
"sndPlaySoundA"
(ByVal
lpszSoundName
As
String,ByVal
uFlags
As
Long)
As
Long
Private
Sub
Form_load()
Dim
SoundFile
As
String,
Result
As
Long
SoundFile
=
"C:\Pwin98\Media\The
Microsoft
Sound.WAV"
'此处为路径
Result
=
sndPlaySound(SoundFile,
1)
End
Sub
'
'
2.使用WINDOWS
MEDIA
PLAYER控件
'
在窗体添加一个WINDOWS
MEDIA
PLAYER,然后修改代码如下:
Private
Sub
Form_Load()
WindowsMediaPlayer1.URL
=
"F:\赤道和北极.mp3"
WindowsMediaPlayer1.Controls.play
End
Sub
'
'
3.使用Multimedia
MCI控件,在窗体加入Microsoft
Multimedia
controls控件,修改代码:
'
Private
Sub
Form_Load()
MMControl1.Visible
=
False
MMControl1.FileName
=
"F:\赤道和北极.mp3"
MMControl1.Command
=
"open"
MMControl1.Command
=
"play"
End
Sub
'
'
4.使用其它类型控件
.......
=========================================
音乐在EXE里面我不会,估计不行
Private
Declare
Function
sndPlaySound
Lib
"Winmm.dll"
Alias
"sndPlaySoundA"
(ByVal
lpszSoundName
As
String,ByVal
uFlags
As
Long)
As
Long
Private
Sub
Form_load()
Dim
SoundFile
As
String,
Result
As
Long
SoundFile
=
"C:\Pwin98\Media\The
Microsoft
Sound.WAV"
'此处为路径
Result
=
sndPlaySound(SoundFile,
1)
End
Sub
'
'
2.使用WINDOWS
MEDIA
PLAYER控件
'
在窗体添加一个WINDOWS
MEDIA
PLAYER,然后修改代码如下:
Private
Sub
Form_Load()
WindowsMediaPlayer1.URL
=
"F:\赤道和北极.mp3"
WindowsMediaPlayer1.Controls.play
End
Sub
'
'
3.使用Multimedia
MCI控件,在窗体加入Microsoft
Multimedia
controls控件,修改代码:
'
Private
Sub
Form_Load()
MMControl1.Visible
=
False
MMControl1.FileName
=
"F:\赤道和北极.mp3"
MMControl1.Command
=
"open"
MMControl1.Command
=
"play"
End
Sub
'
'
4.使用其它类型控件
.......
=========================================
音乐在EXE里面我不会,估计不行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
呵呵 楼上的代码要下载网上的mp3文件才能播放吧。网速不好的情况下要缓冲很长时间。我觉得用资源文件好一些吧。
参考我的一个小例子。
http://z.baidu.com/question/152152327.html
参考我的一个小例子。
http://z.baidu.com/question/152152327.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
放个windowsmediaplyer控件
Private Sub Form_Load()
With WindowsMediaPlayer1
.Visible = False
.URL = "g:\music\kiss_the_rain.mp3"
.settings.playCount = -1
.settings.autoStart = True
End With
End Sub
Private Sub Form_Load()
With WindowsMediaPlayer1
.Visible = False
.URL = "g:\music\kiss_the_rain.mp3"
.settings.playCount = -1
.settings.autoStart = True
End With
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |