Makro Ap_002_Play startet, Makro Ap_002_Stop stoppt die Wiedergabe einer MP3-Musikdatei.
Code-Modul: Standardmodul
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 isPlaying As Boolean
Public Sub Ap_002_Play()
Dim mp3File As String 'Dim mp3File$
mp3File = Chr$(34) & "C:\Musik\Musik.mp3" & Chr$(34)
If isPlaying = True Then
Call mciSendString("Stop MM", 0&, 0&, 0&)
Call mciSendString("Close MM", 0&, 0&, 0&)
Call mciSendString("Open " & mp3File & " Alias MM", 0&, 0&, 0&)
Call mciSendString("Play MM", 0&, 0&, 0&)
Else
Call mciSendString("Open " & mp3File & " Alias MM", 0&, 0&, 0&)
Call mciSendString("Play MM", 0&, 0&, 0&)
isPlaying = True
End If
End Sub
Public Sub Ap_002_Stop()
If isPlaying = False Then Exit Sub
Call mciSendString("Stop MM", 0&, 0&, 0&)
Call mciSendString("Close MM", 0&, 0&, 0&)
End Sub
Download (BAS-Datei als ZIP-Archiv, ca. x KB)
Quelle: wn
|