找回密码
 加入
搜索
查看: 1643|回复: 4

如何停止MP3播放

[复制链接]
发表于 2009-6-22 13:33:44 | 显示全部楼层 |阅读模式
SoundPlay("e:\小酒窝.mp3",1)      播放E盘小酒窝.MP3
哪为大哥能告诉小弟   用什么函数可以停止播放   最好能写出来   我是新手 谢谢了
 楼主| 发表于 2009-6-22 15:40:35 | 显示全部楼层
哪位大哥可以帮帮我啊   我真的不会   研究了一天也没弄明白
发表于 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[128]")
    $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)
发表于 2009-6-22 15:43:49 | 显示全部楼层
_SoundPlay($sound)
_SoundPause($sound)
_SoundResume($sound)
_SoundClose($sound)
够用了吧?
翻翻帮助文件,很容易理解的
 楼主| 发表于 2009-6-22 16:21:11 | 显示全部楼层
太感谢楼上2位大哥了   我好好研究研究
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-23 01:23 , Processed in 0.078523 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表