Option Explicit
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
Dim Res As Integer, Ret As String * 1024
Private Sub Form_Load()
Dim A as Integer, path As String, APPPATH As String
'获得当前路径8.3格式的短路径名
If Right(App.path, 1) = "\" Then path = App.path Else path = App.path & "\"
APPPATH = String$(165, 0)
A = GetShortPathName(path, APPPATH, 164)
APPPATH = Left(APPPATH, InStr(APPPATH, Chr(0)) - 1)
End Sub
Private Sub Form_Click()
Dim Res As Integer, Ret As String * 1024
Res = mciSendString("play " & APPPATH & "伱的音樂.wav from 3000 to 8000", Ret, 1024, 0)
'Res = mciSendString("play " & APPPATH & "伱的音樂.wav", Ret, 1024, 0)'整首播放
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Res = mciSendString("close all", Ret, 1024, 0)
End
End Sub