VB寫鬧鐘如何用Windows的選取的音樂檔來播放(非路徑
這是我鬧鐘的寫法
Label2.Text = Format(Now(), "tt") '上下午
Label1.Text = Format(Now(), "hh:mm:ss") '時/分/秒
Dim urlStr As String = ""
If ListBox1.Items.Count <> 0 Then
If Now() >= CDate(ListBox1.Items(0)) And Now() <= CDate(ListBox1.Items(0)).AddSeconds(10) And playFlag = False Then
*********My.Computer.Audio.Play()****************
playFlag = True
End If
If playFlag = True And Now() > CDate(ListBox1.Items(0)).AddSeconds(10) Then
My.Computer.Audio.Stop()
playFlag = False
ListBox1.Items.RemoveAt(0)
ListBox1.Refresh()
End If
End If
End Sub
在有***的My.Computer.Audio.Play()可以設置音樂檔路徑
但我另外有寫尋找開啟檔案
Dim urlStr As String = ""
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
urlStr = OpenFileDialog1.FileName
我將如何用這開啟檔案寫進鬧鐘程式裡面 播放的音樂就是我開啟的檔案....
因為一直在抓資料 抓到瓶頸
urlStr = OpenFileDialog1.FileName這後面開起好後 我需要如何坐下面動作......
2 個解答
- 匿名使用者9 年前最佳解答
用個全域變數儲存音樂路徑
時間到時抓這個路徑撥放