'======================================================
'获取当前播放进度
'======================================================
Public Function GetMusicPos() As Long
Dim RefStr As String * 80
mciSendString "status NOWMUSIC position", RefStr, 80, 0
GetMusicPos = Val(RefStr)
End Function
'======================================================
'获取媒体的当前进度
'======================================================
Public Function SetMusicPos(Position As Long) As Boolean
Dim RefInt As Long
SetMusicPos = False
RefInt = mciSendString("seek NOWMUSIC to " & Position, vbNull, 0, 0)
If RefInt = 0 Then SetMusicPos = True
End Function
'======================================================
'暂停播放
'======================================================
Public Function PauseMusic() As Boolean
Dim RefInt As Long
PauseMusic = False
RefInt = mciSendString("pause NOWMUSIC", vbNull, 0, 0)
If RefInt = 0 Then PauseMusic = True
End Function
'======================================================
'关闭媒体
'======================================================
Public Function CloseMusic() As Boolean
Dim RefInt As Long
CloseMusic = False
RefInt = mciSendString("close NOWMUSIC", vbNull, 0, 0)
If RefInt = 0 Then CloseMusic = True
End Function
'======================================================
'设置声道
'======================================================
Public Function SetAudioSource(sAudioSource As AudioSource) As Boolean
Dim RefInt As Long
Dim strSource As String
Select Case sAudioSource
Case 1: strSource = "left"
Case 2: strSource = "right"
Case 0: strSource = "stereo"
End Select
SetAudioSource = False
RefInt = mciSendString("setaudio NOWMUSIC source to " & strSource, vbNull, 0, 0)
If RefInt = 0 Then SetAudioSource = True
End Function
'======================================================
'全屏播放
'======================================================
Public Function PlayFullScreen() As Boolean
Dim RefInt As Long
PlayFullScreen = False
RefInt = mciSendString("play NOWMUSIC fullscreen", vbNull, 0, 0)
If RefInt = 0 Then PlayFullScreen = True
End Function