Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrRetumString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As LongDim mfn As StringPrivate Sub Form_load()
mfn = ""
play.Enabled = False
End SubPrivate Sub open_Click()
On Error GoTo err
With CommonDialog1
.CancelError = True
.Filter = "音乐文件|*.mp3;*.wav;*.mid"
.Flags = cdlOFNNoChangeDir And cdlOFNPathMustExist
.Action = 1
mfn = .FileName 
Form1.Caption = .FileName
play.Enabled = True
End With
play_Click
Exit Sub
err:
End SubPrivate Sub play_Click()
Dim t As Long
t = mciSendString("open " + mfn, 0&, 0, 0) 'Open后边的空格一定不能丢
End Sub运行选择文件后无法播放,WHY?