Code : Tout sélectionner
#include <GUIConstants.au3>
#include <Sound.au3>
DIM $Read
$GUI = GUICreate("Music Player v2.0", 270, 70, -1, -1)
$Input_1 = GUICtrlCreateInput("", 10, 10, 220, 20)
$Button_1 = GUICtrlCreateButton("...", 240, 10, 20, 20)
$Button_2 = GUICtrlCreateButton("Play", 10, 35, 80)
$Button_3 = GUICtrlCreateButton("Pause", 95, 35, 80)
$Button_4 = GUICtrlCreateButton("Stop", 180, 35, 80)
GUICtrlSetState($Button_2, $GUI_DISABLE)
GUICtrlSetState($Button_3, $GUI_DISABLE)
GUICtrlSetState($BUtton_4, $GUI_DISABLE)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button_1
$Opened_File = FileOpenDialog("Open Music File", "", "All Music Files (*.wav;*.avi;*.mp3)|All Files (*.*)",12)
GUICtrlSetData($Input_1, $Opened_File)
GUICtrlSetState($Button_2, $GUI_ENABLE)
Case $nMsg = $Button_2
$Read = GUICtrlRead($Input_1)
$Play = _SoundPlay($Read)
GUICtrlSetState($Button_3, $GUI_ENABLE)
GUICtrlSetState($Button_4, $GUI_ENABLE)
Case $nMsg = $Button_3
_SoundPause($Read)
Case $nMsg = $Button_4
GUICtrlSetState($Button_3, $GUI_DISABLE)
_SoundStop($Read)
EndSelect
WEnd