用vb程序设计一个“定时器”软件,要求定时时间到时会播放一段音乐,那个音乐怎么弄啊!谁能能帮帮忙?

加入一个定时器控件,interval属性改为1000,

加入一个命令按键控件,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是重复时的间隔,还不懂就追问我,忙活了这么长时间,怎么也得给个辛苦分吧?