返回列表 上一主題 發帖

[發問] WindowsMediaPlayer播放音檔問題

[發問] WindowsMediaPlayer播放音檔問題

請問各位大大,小弟使用vba WindowsMediaPlayer撥放音檔,
分別加入14個音檔list後,卻無法一次播完,平均每4個音檔會停止撥放,
在煩請大大解惑謝謝!
程式碼如下
Public Sub macro_test2()

Dim Bk_A As String
Bk_A = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 5)
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Dim book_name As String
Dim book_path As String

book_name = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 5)
book_path = ThisWorkbook.Path

工作表001.WindowsMediaPlayer1.currentPlaylist.Clear

music_path01 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_各位旅客您好" & ".wav"
music_path02 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_6點" & ".wav"
music_path03 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分50" & ".wav"
music_path04 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分" & ".wav"
music_path05 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_開往" & ".wav"
music_path06 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_台北的" & ".wav"
music_path07 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次5" & ".wav"
music_path08 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0" & ".wav"
music_path09 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0" & ".wav"
music_path10 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_次" & ".wav"
music_path11 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_高鐵" & ".wav"
music_path12 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_北上" & ".wav"
music_path13 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_的列車即將進站請前往" & ".wav"
music_path14 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_第二月台" & ".wav"
music_path15 = ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_搭乘並留意月台間隙謝謝" & ".wav"

Dim Xwmp As IWMPMedia

工作表001.WindowsMediaPlayer1.currentPlaylist.Clear

Set Xwmp = 工作表001.WindowsMediaPlayer1.newMedia(music_path05)
工作表001.WindowsMediaPlayer1.currentPlaylist.insertItem 0, Xwmp

工作表001.WindowsMediaPlayer1.Controls.Play

Set Xwmp = 工作表001.WindowsMediaPlayer1.newMedia(music_path06)
工作表001.WindowsMediaPlayer1.currentPlaylist.insertItem 1, Xwmp

工作表001.WindowsMediaPlayer1.Controls.Play

Set Xwmp = 工作表001.WindowsMediaPlayer1.newMedia(music_path07)
工作表001.WindowsMediaPlayer1.currentPlaylist.insertItem 2, Xwmp

工作表001.WindowsMediaPlayer1.Controls.Play

Set Xwmp = 工作表001.WindowsMediaPlayer1.newMedia(music_path08)
工作表001.WindowsMediaPlayer1.currentPlaylist.insertItem 3, Xwmp

工作表001.WindowsMediaPlayer1.Controls.Play

End Sub

回復 1# lshsien
你下面只插入第 5,6,7,8 首到撥放清單。
表達不清、題意不明確、沒附檔案格式、沒有討論問題的態度~~~~~~以上愛莫能助。

TOP

回復 1# lshsien
添加一個新的模塊,將下面的代碼粘貼到此模塊中:
  1. Option Explicit

  2. #If VBA7 Then
  3.   Private Declare PtrSafe Function waveOutGetNumDevs Lib "winmm.dll" () As Long
  4.   Private Declare PtrSafe Function mciSendString Lib "winmm.dll" Alias "mciSendStringW" (ByVal lpstrCommand As LongPtr, ByVal lpstrRetumString As LongPtr, ByVal uReturnLength As Long, ByVal hwndCallback As LongPtr) As Long
  5.   Private Declare PtrSafe Function GetShortPathNameW Lib "kernel32" (ByVal lpszLongPath As LongPtr, ByVal lpszShortPath As LongPtr, ByVal cchBuffer As Long) As Long
  6.   Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  7.   Private Declare PtrSafe Function PathFindExtension Lib "shlwapi.dll" Alias "PathFindExtensionW" (ByVal pszPath As LongPtr) As LongPtr
  8.   Private Declare PtrSafe Function lStrLen Lib "kernel32.dll" Alias "lstrlenW" (ByVal lpString As LongPtr) As Long
  9.   Private Declare PtrSafe Sub CopyMemoryByPtr Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal Destination As LongPtr, ByVal Source As LongPtr, ByVal Length As Long)
  10. #Else
  11.   Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
  12.   Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringW" (ByVal lpstrCommand As Long, ByVal lpstrRetumString As Long, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
  13.   Private Declare Function GetShortPathNameW Lib "kernel32" (ByVal lpszLongPath As Long, ByVal lpszShortPath As Long, ByVal cchBuffer As Long) As Long
  14.   Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  15.   Private Declare Function PathFindExtension Lib "shlwapi.dll" Alias "PathFindExtensionW" (ByVal pszPath As Long) As Long
  16.   Private Declare Function lStrLen Lib "kernel32.dll" Alias "lstrlenW" (ByVal lpString As Long) As Long
  17.   Private Declare Sub CopyMemoryByPtr Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
  18. #End If

  19. Private Type FileList
  20.   FileName  As String
  21.   ShortName As String
  22. End Type

  23. Private FileList() As FileList
  24. Private ListCount  As Long

  25. Public Sub Clean()
  26.   ListCount = 0
  27.   Erase FileList
  28. End Sub

  29. Public Property Get Item(ByVal Index As Long) As String
  30.   If Index > 0 And Index <= ListCount Then
  31.     Item = FileList(Index).FileName
  32.   End If
  33. End Property

  34. Public Property Let Item(ByVal Index As Long, ByVal FileName As String)
  35.   Dim I As Long
  36.   If Index = ListCount + 1 Then
  37.     ListCount = ListCount + 1
  38.     ReDim Preserve FileList(1 To ListCount)
  39.   End If
  40.   If (Index > 0) And (Index <= ListCount) Then
  41.     With FileList(Index)
  42.       .FileName = FileName
  43.       
  44.       I = Len(FileName)
  45.       If I > 0 Then
  46.         .ShortName = GetShortPathName(FileName)
  47.       Else
  48.         .ShortName = vbNullString
  49.       End If
  50.     End With
  51.   End If
  52. End Property

  53. Public Function ItemAdd(ByVal FileName As String) As Long
  54.   Dim I As Long
  55.   I = ListCount + 1
  56.   Item(I) = FileName
  57.   ItemAdd = I
  58. End Function

  59. Public Function ItemReMove(ByVal Index As Long) As Boolean
  60.   If Index > 0 And Index <= ListCount Then
  61.     With FileList(Index)
  62.       .FileName = vbNullString
  63.       .ShortName = vbNullString
  64.     End With
  65.   End If
  66. End Function

  67. Public Sub StartPlay()
  68.   Dim I         As Long
  69.   
  70.   If waveOutGetNumDevs > 0 Then
  71.     For I = 1 To ListCount Step 1
  72.       With FileList(I)
  73.         If Len(.ShortName) Then
  74.           Select Case UCase$(ExtractFileExtension(.ShortName))
  75.             Case ".WAV": mciSendString StrPtr("open " & .ShortName & " type waveaudio alias JofornMusic"), 0, 0, 0
  76.             Case ".MDI": mciSendString StrPtr("open " & .ShortName & " type sequencer alias JofornMusic"), 0, 0, 0
  77.             Case Else:   mciSendString StrPtr("open " & .ShortName & " alias JofornMusic"), 0, 0, 0
  78.           End Select
  79.           mciSendString StrPtr("play JofornMusic FROM 0"), 0&, 0, 0
  80.           Do While Not IsEnd
  81.             Sleep 50
  82.             DoEvents
  83.           Loop
  84.           mciSendString StrPtr("close JofornMusic"), 0&, 0, 0
  85.         End If
  86.       End With
  87.     Next I
  88.   End If
  89. End Sub

  90. Private Function IsEnd() As Boolean
  91.   Dim I         As Long
  92.   Dim strStatus As String
  93.   
  94.   strStatus = String$(256, vbNullChar)
  95.   mciSendString StrPtr("status JofornMusic mode"), StrPtr(strStatus), 256, 0
  96.   I = InStr(strStatus, vbNullChar)
  97.   If I > 1 Then
  98.     IsEnd = UCase$(Left$(strStatus, I - 1)) = "STOPPED"
  99.   Else
  100.     IsEnd = True
  101.   End If
  102. End Function

  103. '从路径提取文件后缀名
  104. Public Function ExtractFileExtension(ByVal strPath As String) As String
  105.   #If VBA7 Then
  106.     Dim ptrExt As LongPtr
  107.   #Else
  108.     Dim ptrExt As Long
  109.   #End If
  110.   Dim ExtLen As Long
  111.   
  112.   strPath = strPath & vbNullChar
  113.   ptrExt = PathFindExtension(StrPtr(strPath))
  114.   If ptrExt Then
  115.     ExtLen = lStrLen(ptrExt)
  116.     If ExtLen > 0 Then
  117.       ExtractFileExtension = String(ExtLen, vbNullChar)
  118.       CopyMemoryByPtr StrPtr(ExtractFileExtension), ptrExt, ExtLen * 2
  119.     End If
  120.   End If
  121. End Function

  122. Public Sub StopPlay()
  123.   mciSendString StrPtr("close JofornMusic"), 0&, 0, 0
  124. End Sub

  125. Private Function GetShortPathName(ByVal FileName As String) As String
  126.   Dim I       As Long
  127.   Dim strTemp As String
  128.   
  129.   strTemp = Space$(256)
  130.   I = GetShortPathNameW(StrPtr(FileName), StrPtr(strTemp), 256)
  131.   If I > 0 Then GetShortPathName = Left$(strTemp, I)
  132. End Function
複製代碼
將原有的代碼修改為:
  1. Public Sub macro_test2()

  2.     Dim Bk_A As String
  3.     Bk_A = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 5)
  4.     '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  5.    
  6.     Dim book_name As String
  7.     Dim book_path As String
  8.    
  9.     book_name = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 5)
  10.     book_path = ThisWorkbook.Path
  11.    
  12.     Clear
  13.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_各位旅客您好" & ".wav"
  14.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_6點" & ".wav"
  15.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分50" & ".wav"
  16.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分" & ".wav"
  17.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_開往" & ".wav"
  18.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_台北的" & ".wav"
  19.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次5" & ".wav"
  20.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0" & ".wav"
  21.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0" & ".wav"
  22.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_次" & ".wav"
  23.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_高鐵" & ".wav"
  24.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_北上" & ".wav"
  25.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_的列車即將進站請前往" & ".wav"
  26.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_第二月台" & ".wav"
  27.     ItemAdd ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_搭乘並留意月台間隙謝謝" & ".wav"
  28.     StartPlay
  29. End Sub
複製代碼
完成上面的兩步操作後運行macro_test2測試。
世界那麼大,可我想去哪?

TOP

注:樓上的代碼不需要MediaPlayer控件。
世界那麼大,可我想去哪?

TOP

回復 1# lshsien
正如 Joforn 大大所提示的,以下的
代碼不需要 MediaPlayer 的支援控件。
如果你較習慣使用 MediaPlayer 控件
那麼你便可以不用往下閱覽了。
  1. Option Explicit

  2. Private Const SND_APPLICATION = &H80         '  look for application specific association
  3. Private Const SND_ALIAS = &H10000            '  name is a WIN.INI [sounds] entry
  4. Private Const SND_ALIAS_ID = &H110000        '  name is a WIN.INI [sounds] entry identifier
  5. Private Const SND_ASYNC = &H1                '  play asynchronously
  6. Private Const SND_FILENAME = &H20000         '  name is a file name
  7. Private Const SND_LOOP = &H8                 '  loop the sound until next sndPlaySound
  8. Private Const SND_MEMORY = &H4               '  lpszSoundName points to a memory file
  9. Private Const SND_NODEFAULT = &H2            '  silence not default, if sound not found
  10. Private Const SND_NOSTOP = &H10              '  don't stop any currently playing sound
  11. Private Const SND_NOWAIT = &H2000            '  don't wait if the driver is busy
  12. Private Const SND_PURGE = &H40               '  purge non-static events for task
  13. Private Const SND_RESOURCE = &H40004         '  name is a resource name or atom
  14. Private Const SND_SYNC = &H0                 '  play synchronously (default)

  15. #If VBA7 Then
  16.     Private Declare PtrSafe Function PlaySoundA Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
  17.     '  以上係 .Wav 檔之參數宣告; 下列三行為 .MP3 檔案宣告之引用功能函式及變數宣告。
  18.     Private Declare PtrSafe 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
  19.     Private Declare PtrSafe Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
  20. #Else
  21.     Private Declare Function PlaySoundA Lib "winmm.dll" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
  22.     '  以上係 .Wav 檔之參數宣告; 下列三行為 .MP3 檔案宣告之引用功能函式及變數宣告。
  23.     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
  24.     Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
  25. #End If

  26. Dim Mp3File, LastMp3File As String, lst() As String, idx As Long

  27. Sub Ex()
  28.     Dim cnt As Long
  29.    
  30.     idx = 0
  31.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_各位旅客您好.wav")
  32.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_6點.wav")
  33.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分50.wav")
  34.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_分.wav")
  35.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_開往.wav")
  36.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_台北的.wav")
  37.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次5.wav")
  38.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0.wav")
  39.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_車次0.wav")
  40.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_次.wav")
  41.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_高鐵.wav")
  42.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_北上.wav")
  43.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_的列車即將進站請前往.wav")
  44.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_第二月台.wav")
  45.     addList (ThisWorkbook.Path & "\" & "常用廣播" & "\" & "國語_搭乘並留意月台間隙謝謝.wav")
  46.         
  47.     For cnt = 1 To UBound(lst)
  48.         If UCase(Right(lst(cnt), 4)) = ".WAV" Then
  49.             PlaySound (lst(cnt))
  50.         ElseIf UCase(Right(lst(cnt), 4)) = ".MP3" Then
  51.             MMStop (LastMp3File)
  52.             LastMp3File = lst(cnt)
  53.             MMPlay (lst(cnt))
  54.         End If
  55.     Next cnt
  56.         
  57.     rmvList
  58. End Sub

  59. Public Function addList(ByVal fn As String)
  60.     Dim num As Long
  61.    
  62.     If idx = 0 Then num = 1 Else num = UBound(lst) + 1
  63.     ReDim Preserve lst(num)
  64.     lst(num) = fn
  65.     idx = idx + 1
  66. End Function

  67. Public Function rmvList()
  68.     If idx = 0 Then Exit Function
  69.     ReDim Preserve lst(0)   '  lst :  String(0 to 0)
  70.     idx = 0                 '  UBound(lst) = 0 : Long
  71. End Function

  72. ' Purpose     :  Plays an audio file
  73. ' Inputs      :  sFilePath           The location of the wav file
  74. '                lFlags              Can be one or many of the constants given above
  75. ' Outputs     :  The text found on the web site
  76. ' Author      :  Andrew Baker
  77. ' Date        :  21/10/2000 12:37
  78. ' Notes       :  Code adapted from code found on www.allapi.net (excellent site!)
  79. ' Revisions   :

  80. Function PlaySound(sFilePath As String, Optional lFlags As Long = SND_FILENAME Or SND_ASYNC) As Long
  81.     PlaySound = PlaySoundA(sFilePath, 0&, lFlags)
  82. End Function

  83. Function ConvShortFilename(ByVal strLongPath$) As String
  84.     Dim strShortPath$
  85.     If InStr(1, strLongPath, " ") Then
  86.         strShortPath = String(LenB(strLongPath), Chr(0))
  87.         GetShortPathName strLongPath, strShortPath, Len(strShortPath)
  88.         ConvShortFilename = Left(strShortPath, InStr(1, strShortPath, Chr(0)) - 1)
  89.     Else
  90.         ConvShortFilename = strLongPath
  91.     End If
  92. End Function

  93. Private Sub MMPlay(ByRef FileName As String)
  94.     FileName = ConvShortFilename(FileName)
  95.     mciSendString "close " & FileName, vbNullString, 0, 0
  96.     mciSendString "open " & FileName, vbNullString, 0, 0
  97.     mciSendString "play " & FileName, vbNullString, 0, 0
  98. End Sub

  99. Private Sub MMStop(ByRef FileName As String)
  100.     FileName = ConvShortFilename(FileName)
  101.     mciSendString "stop " & FileName, vbNullString, 0, 0
  102.     mciSendString "close " & FileName, vbNullString, 0, 0
  103. End Sub
複製代碼
1

評分人數

TOP

To stillfish00大大
不好意思,小弟沒貼到後面的。
To Joforn、c_c_lai兩位大大
感謝您的指導,目前正在努力測試中,
因小弟學習剛起步,對於兩位大大所寫的還是一知半解,
目前努力的理解中,
想請問大大,若使用MediaPlayer 控件,
是否有辦法解決小弟的問題,
謝謝!

TOP

以〔短語音〕mp3實測,
WindowsMediaPlayer並無四檔即停播問題,

或許上傳檔案較可能找出原因~~

TOP

回復 6# lshsien
雖然你偏好使用 Windows Media Player,
但我使用 Joforn 大大提供的程式碼測試
三種型態的媒體檔 (*.mp3;*.wav;*.mp4)
它在執行撥放過程非常穩定,DoEvents 的
時段拿捏得恰當,尤其是 mp4 影片撥放
視窗也很流暢,蠻值得你採用。其實
Windows Media Player元件亦使用同樣之
Windows System 程式庫 (Lib)。
  1. Sub Ex()
  2.     ItemAdd (ThisWorkbook.Path & "\" & "大悲咒天使波羅蜜.wav")
  3.     ItemAdd (ThisWorkbook.Path & "\" & "舒伯特 小夜曲 大提琴演奏 .mp4")
  4.     ItemAdd (ThisWorkbook.Path & "\" & "寶篋咒.mp3")
  5.     ItemAdd (ThisWorkbook.Path & "\" & "聖誕快樂 01.mp4")
  6.     ItemAdd (ThisWorkbook.Path & "\" & "01_巴哈 G弦之歌 Air On the G string.mp3")
  7.     ItemAdd (ThisWorkbook.Path & "\" & "舒伯特 小夜曲 大提琴演奏 .mp4")
  8.     ItemAdd (ThisWorkbook.Path & "\" & "02_NOCTURNE.mp3")
  9.     ItemAdd (ThisWorkbook.Path & "\" & "03_SAULT D' AMOUR.mp3")
  10.     ItemAdd (ThisWorkbook.Path & "\" & "04_JUNE(BARCAROLLE).mp3")
  11.    
  12.     StartPlay
  13. End Sub
複製代碼

TOP

回復 3# Joforn

請問播放以後如何臨時暫停或中斷撥放
{...} 表示需要用 CTRL+SHIFT+ENTER 三鍵輸入公式

TOP

回復  Joforn

請問播放以後如何臨時暫停或中斷撥放
ML089 發表於 2016-1-22 20:04
  1. Public Property Get Pause() As Boolean
  2.   Dim I         As Long
  3.   Dim strStatus As String
  4.   
  5.   strStatus = String$(256, vbNullChar)
  6.   mciSendString StrPtr("status JofornMusic mode"), StrPtr(strStatus), 256, 0
  7.   I = InStr(strStatus, vbNullChar)
  8.   If I > 1 Then
  9.     Debug.Print Left$(strStatus, I - 1)
  10.     Pause = UCase$(Left$(strStatus, I - 1)) = "PAUSED"
  11.   End If
  12. End Property

  13. Public Property Let Pause(ByVal Value As Boolean)
  14.   If Value Xor Pause Then
  15.     If Value Then
  16.       mciSendString StrPtr("pause JofornMusic"), 0, 0, 0
  17.     Else
  18.       mciSendString StrPtr("resume JofornMusic"), 0, 0, 0
  19.     End If
  20.   End If
  21. End Property
複製代碼
調用Pause=True就可以暫停,Pause=False繼續播放。
世界那麼大,可我想去哪?

TOP

        靜思自在 : 愛不是要求對方,而是要由自身的付出。
返回列表 上一主題