Private Sub Play_Click()
    With MMControl1
        .DeviceType = "waveaudio"
        .FileName = App.Path & "\闹铃.wav"
        .Command = "open"
        .Command = "play"
    End With
End Sub
Private Sub Timer1_Timer()
    Play_Click
End Sub

解决方案 »

  1.   

    在一个周期里面Timer1_Timer
       play还没有播放完毕,建议把Timer1周期设大些试试
      

  2.   

    达到同样效果可以采用
    rivate Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    Private Sub Form_Load()
        PlaySound App.Path & "\闹铃.wav", &H1 
    End Sub
      

  3.   

    我不能够用API。只能用控件了!
      

  4.   

    Private Sub Timer1_Timer()
        Timer1.enable=false
        Play_Click
        Timer1.enable=true
    End Sub
      

  5.   

    Sub wait_play()
        Dim i, OpenForms
        Dim play_wait As Boolean    play_wait = PlaySound("", 0&, SND_ASYNC)
        Do While Not play_wait
            OpenForms = DoEvents '将执行让给操作系统。
            play_wait = PlaySound("", 0&, SND_ASYNC)
        Loop
    End Sub
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        PlaySound "", 0&, SND_ASYNC
    End SubPrivate Sub Form_Unload(Cancel As Integer)
         PlaySound "", 0&, SND_ASYNC
    End Sub现在达到我的目的了。可是当退出程序后响声依旧呀
      

  6.   

    我想用一个按钮实现停止声音播放。可是不行那。
    Private Sub Command1_Click()
        PlaySound "", 0&, SND_ASYNC
        Timer1.Enabled = False
    End Sub