贴上代码吧 可能更容易理解#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 640, 480)
$Input1 = GUICtrlCreateInput(@WindowsDir & "\media\tada.wav", 20, 20, 300, 20)
$Button1 = GUICtrlCreateButton("选择MP3文件", 340, 20, 100, 20)
$Button2 = GUICtrlCreateButton("开始播放", 460, 20, 60, 20)
$Button3 = GUICtrlCreateButton("停止播放", 540, 20, 60, 20)
$Label1 = GUICtrlCreateLabel("声卡选择", 20, 60, 100, 20)
$Combo1 = GUICtrlCreateCombo("", 100, 60, 400, 20, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$File=FileOpenDialog("选择MP3文件", "", "MP3文件(*.mp3)")
If @error Then
MsgBox(4096,"","没有选择文件!")
Else
GUICtrlSetData($Input1,$File)
EndIf
Case $Button2
SoundPlay(GUICtrlRead($Input1))
Case $Button3
SoundPlay("")
EndSwitch
WEnd
|