📄 020304.htm
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>vb study</title><style>
<!--
td {font-size: 9pt}
A:link {text-decoration: none; color: #0033cc;font-size: 9pt}
A:visited {text-decoration: none; color: #0066CC;font-size: 9pt}
A:active {text-decoration: none; color: #ff0000; font-size: 9pt}
A:hover {text-decoration: underline; color: #000000;font-size: 9pt}
-->
</style>
</head>
<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td width="100%"><a href="#">你的位置</a>:<a href="http://www.xxby.com" target="_blank">华生小屋</a>--<a href="#">VB学习</a>--<a href="#">ActiveX控件</a></td>
</tr>
<tr>
<td width="100%">
<p align="center"><font size="2">多媒体控件(ActiveMovie和)MediaPlayer控件</font></td>
</tr>
<tr>
<td width="100%"><br>
<font size="2">★ 还有一个很有用的多媒体控件MCIWND控件,使用起来更加方便,如:<br>
MCIWnd1.FileName = "e:\dmt\back.wav"<br>
MCIWnd1.Command = "open"<br>
MCIWnd1.Command = "play"<br>
就可以了。<br>
多媒体MCIWND控件,它有multimedia mci控件的类似command命令,同时又增加了许多功能。它可将活动画面嵌入窗体内部(将它的autosizewindow属性设为False,不允许脱离窗口),也可以随意定制动画的大小,先将其autosizewindow设为true,再通过它的zoom属性精确指定画面的大小。<br>
mciwnd1.playbar属性:选择是否显示播放进度条(布尔值)。<br>
mciwnd1.menu属性:选择运行时是否显示控件固有的菜单(布尔值)。<br>
mciwnd1.speed属性:设定播放速度(缺省为1000正常速度),在代码中设置。<br>
mciwnd1.volume属性:设定播放时的音量(缺省为1000原始音量),在代码中设置。<br>
Mciwnd1.Position属性:从指定位置开始播放。如:<br>
MCIWnd1.FileName = "d:\美女.mpg"<br>
MCIWnd1.Command = "open"<br>
MCIWnd1.Position = 100<br>
MCIWnd1.Command = "play"<br>
★ Animation(动画)控件:<br>
功能:显示无声的.avi文件。它在代码中的缺省名为animation1.包含在microsoft windows common controls-2 6.0中。<br>
方法:OPEN 打开.avi文件;格式:animation1.open 文件名<br>
PLAY 播放; 格式:animation1.play 它可带三个参数:<br>
animation1.play 重复播放多少遍,起始帧,结束帧<br>
animation1.play 10,5,15 意为重复播放10遍,范围从5至15帧。缺省为从开始到结束帧重复无限次。 <br>
STOP 停止播放; 格式:animation1.stop <br>
CLOSE 关闭文件。<br>
Private Sub Form_Load()<br>
Animation1.Open "e:\dmt\Hope01.avi"<br>
Animation1.Play<br>
End Sub<br>
用autoplay属性自动播放文件。格式:animation1.autoplay=true<br>
这样,在加载文件后自动播放,如下:<br>
commondialog1.showopen<br>
animation1.autoplay=true<br>
animation1.file=commondialog1.filename<br>
animation对象的center属性,是否使播放区居中;true时居中,false时自动改变大小匹配AVI画面尺寸。<br>
★ 怎样使多媒体multimedia MCI控件自动不断重复播放一段音乐?先了解几个属性:<br>
mode属性:返回MCI设备的当前状态,有:524--设备没打开;525--设备停止;<br>
526--设备正在播放;527--设备正在记录(存盘);528--设备正在搜索;529--设备暂停;530--设备准备好。<br>
UpdateInterval属性:设置每两次连续发生的StatusUpdate事件间隔的毫秒数。<br>
StatusUpdate事件:这个事件会连续不断地发生,每次间隔时间为updateinterval属性指定的时间。可在此事件中用mode属性检测设备的状态,并进行重放。<br>
from、to、length和position属性:规定设备"打开"或"保存"的起始点,终点,长度,当前位置。<br>
要重复播放一段音乐,只要在自动连续发生的statusupdate事件中不断去检测mode状态是否"放完了",然后在这个事件中进行重放就可以了。如下:<br>
Private Sub Form_Load()<br>
MMControl1.UpdateInterval = 2000<br>
MMControl1.Notify = False<br>
MMControl1.Wait = True<br>
MMControl1.Shareable = False<br>
MMControl1.DeviceType = "waveaudio"<br>
MMControl1.FileName = "e:\dmt\back.wav"<br>
MMControl1.Command = "open"<br>
MMControl1.Command = "play"<br>
End Sub<br>
Private Sub MMControl1_StatusUpdate()<br>
If MMControl1.Mode = 525 Then<br>
MMControl1.Command = "prev"<br>
MMControl1.Command = "play"<br>
End If<br>
End Sub<br>
如果是MCIWND控件,则对应的属性有mode,timerFreq和modechange事件,注:它的mode属性返回值为字符串:准备播放为"seeking",正在播放为"playing",停止播放为"stopped".</font>
<p align="center">
<br>
< <a href="020303.htm">上一页</a>--<a href="http://www.xxby.com" target="_blank">华生小屋</a>--<a href="020401.htm">下一页</a>
><br>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -