加入一个命令按键控件,caption属性改为“开始计时”,
加入一个复选框控件,cpation属性改“开始计时后自动隐藏程序”,
其它属性一律不要动!
然后打开代码窗口毁衫,把里面的内容清空,把下面一段代码粘贴进去:
Dim dingshi As String
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub PlayWavFile(strFileName As String, PlayCount As Long, JianGe As Long)
'strFileName 要播放的文件名(带路径)
'playCount 播放的次数
'JianGe 多次播放时,每次的时间间隔
If Len(Dir(strFileName)) = 0 Then Exit Sub
If PlayCount = 0 Then Exit Sub
If JianGe <1000 Then JianGe = 1000
DoEvents
sndPlaySound strFileName, 16 + 1
Sleep JianGe
Call PlayWavFile(strFileName, PlayCount - 1, JianGe)
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
If Check1.Value = 1 Then
Form1.Hide
App.TaskVisible = False
End If
End Sub
Private Sub Form_Load()
Show
Timer1.Enabled = False
dingshi = InputBox("时间格式为00:00:00,请输入正确,否则出错", "输入")
End Sub
Private Sub Timer1_Timer()
If dingshi = Time$ Then
PlayWavFile "C:\Documents and Settings\Administrator\桌面\配乎余迟音\火星片花-广告回来继续关注.wav", 1, 1000
End If
End Sub
输入时间格式岁李时那个冒号要是英文的冒号,中文的会出错,
最后这句PlayWavFile "C:\Documents and Settings\Administrator\桌面\配音\火星片花-广告回来继续关注.wav", 1, 1000
路径改成你的声音路径,格式必须是.wav格式的,不然播放不出来,后面那个1是重复次数,那个1000是重复时的间隔,还不懂就追问我,忙活了这么长时间,怎么也得给个辛苦分吧?
一般而言音乐的播放是用定时器来控制的,比如脊扮用外部中断0来控制音正咐乐的启停,定时器0控制的是音乐频率,那么大概程序如下:#include
sbit
p32=p3^2
void
ext0()
interrupt
0
{
while(p32==0)
tr0=~tr0
}
main()
{
initt0()//定时器樱清灶初始化
ex0=1
ea=1
it0=1
...........
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)