回复 1# thealert
我这里正常,但是长度不到1秒的文件就当不存在.
#include <Sound.au3>
;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
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
MsgBox(0, "Sound Length", "The Sound has a length of:" & @CRLF & "hh:mm:ss - " & _
_SoundLength($sound, 1) & @CRLF & "Milliseconds - " & _SoundLength($sound, 2))
|