|
能获取mp3播放时间长度,不能得到mid播放的时间长度,怎么回事?
Option Explicit
Public 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
Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Sub getTest()
Dim mPath As String, mTime As Long
mPath = Space(16)
Call mciSendString("status " & ActiveWorkbook.Path & "\mp3\" & Sheets("A").Cells(2, 5) & " length", mPath, 15, 0)
mTime = Val(mPath)
Sheets("A").Cells(2, 6) = Int(mTime / 1000)
MsgBox (Sheets("A").Cells(2, 6))
End Sub
|
|