Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click Call musicStop() 'クリック時のテキスト(sender.text)をファイル名として投げる Call mciSendString(String.Format("open ""{0}"" alias MySound", sender.text), "", 0, 0) Call mciSendString("play MySound", "", 0, 0) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call musicStop() End Sub Private Sub musicStop() '曲を止める Call mciSendString("stop MySound", "", 0, 0) Call mciSendString("close MySound", "", 0, 0) End Sub