wangzi5669 发表于 2009-6-22 13:33:44

如何停止MP3播放

SoundPlay("e:\小酒窝.mp3",1)      播放E盘小酒窝.MP3
哪为大哥能告诉小弟   用什么函数可以停止播放   最好能写出来   我是新手 谢谢了

wangzi5669 发表于 2009-6-22 15:40:35

哪位大哥可以帮帮我啊   我真的不会   研究了一天也没弄明白

lynfr8 发表于 2009-6-22 15:42:26

#include <Sound.au3>
;open sound file
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav", "Startup")
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @error = 3 Then
    MsgBox(0, "Error", "The alias was invalid")
    Exit
ElseIf @extended <> 0 Then
    $extended = @extended ;assign because @extended will be set after DllCall
    $stText = DllStructCreate("char")
    $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
    MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound)
Sleep(1000)
_SoundPause($sound)
Sleep(1000)
_SoundResume($sound)
While 1
    Sleep(100)
    If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd

_SoundClose($sound)

lynfr8 发表于 2009-6-22 15:43:49

_SoundPlay($sound)
_SoundPause($sound)
_SoundResume($sound)
_SoundClose($sound)
够用了吧?
翻翻帮助文件,很容易理解的

wangzi5669 发表于 2009-6-22 16:21:11

太感谢楼上2位大哥了   我好好研究研究
页: [1]
查看完整版本: 如何停止MP3播放