當前位置:最新電影網 - 音樂下載 - 編寫壹段VB代碼來播放指定音樂!

編寫壹段VB代碼來播放指定音樂!

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Private Sub Command1_Click()

FileName = "d:\music\tom.mp3"

mciSendString "Close MM", 0, 0, 0

mciSendString "Open " & FileName & " Alias MM", 0, 0, 0

mciSendString "Play MM", 0, 0, 0

End Sub

Private Sub Form_Unload(Cancel As Integer)

mciSendString "Close MM", 0, 0, 0

End Sub