VB做电子报时钟(18)
时间:2025-04-05
时间:2025-04-05
模拟电子钟 带语音报时功能
Call GetLocalTime( dangqianshijian ) miao = dangqianshijain . wSecond miao = 60 – miao
fen = dangqianshijian . wMinute fen = 60 - fen
shi = dangqianshijian . wHour
If shi >= 12 Then ‘因为一天之内时针要走二十四个钟头,也就是要走两圈,所以将下午和晚上的时间减去十二,就可以确定时针准确的位置 shi = shi - 12 End If
shi = 12 - shi
miao = xianshimiao ( maio )
fen = xianshifen ( fen ) shi = xianshishi ( shi )
If fen = 0 and miao = 0 then ‘如果分针和秒针都为零,这位整点,根据时针的数报时
Select case shi
Case 0 ‘零点,0.wav报时零点
MMControl1.FileName = App . Path & “ 0.wav ” ‘选择要打开的文件
ErrorCode = mciSendString ( “ Open ” & App . Path & “ 0.wav ” & “ type
WaveAudio alias wave ” , ReturnString , 256, 0 ) ‘打开所选择的文件
ErrorCode = mciSendString ( “ Play wave ”, ReturnStr , 256 , 0 ) ‘播放所选择的文件
Case 1 ‘ 一点,1.wav报时一点,以下依次类推
MMControl1.FileName = App . Path & “ 1.wav ” ‘选择要打开的文件
ErrorCode = mciSendString (“Open” & App.Path & “0.wav” & “type WaveAudio alias wave ” , ReturnString , 256 , 0 )
‘打开所选择的文件
ErrorCode = mciSendString (“ Play wave” , ReturnStr , 256 , 0 ) ‘播放所选择的文件
Case 2
MMControl1.FileName = App . Path & “ 2.wav ”
ErrorCode = mciSendString ( “Open” & App.Path & “0.wav” & “type WaveAudio alias wave ” , ReturnString , 256 , 0 )
‘打开所选择的文件
ErrorCode = mciSendString ( “ Play wave ” , ReturnSt r , 256 , 0) ‘播放所选择的文件
Case 3
MMControl1.FileName = App . Path & “ 3.wav ”
ErrorCode = mciSendString ( “ Open ” & App . Path & “ 0.wav ” & “ type WaveAudio alias wave ” , ReturnString , 256 , 0 )
‘打开所选择的文件
ErrorCode = mciSendString ( “ Play wave ” , ReturnStr , 256 , 0 ) ‘播放所选择的文件
上一篇:青春作伴好读书策划书
下一篇:被压扁的沙子2