Mini Media Player

« Older   Newer »
  Share  
Gianlu-thebest
CAT_IMG Posted on 7/2/2010, 10:17     +1   -1




Ciaoo ho creato un mio media player... non è granchè l'ho fatto in un'oretta perchè non sapevo che fare!
Per sentirlo dovete avere anche il file audio.au3(nella stessa cartella)
SPOILER (click to view)
CODICE
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <audio.au3>

$file = GUICtrlCreateMenu("File")
$fileopen = GUICtrlCreateMenuItem("Open Sound",$file)
$fileexit = GUICtrlCreateMenuItem("Exit",$file)

TrayTip("Welcome","Hi! Welcome My Media Player!",5)

GUICreate("Mini Media Player", 300,100)
GUISetBkColor(0x7FD4FF)
GUICtrlCreateLabel("Welcome a Mini Media Player!",2,2)
GUISetBkColor(0x7FD4FF)
$play = GUICtrlCreateButton("Play",150,50)
$Pause = GUICtrlCreateButton("Pause", 110,50)
$Stop = GUICtrlCreateButton("Stop",180,50)
$apri = GUICtrlCreateButton("Open file",5,50)
$file = GUICtrlCreateMenu("File")
$fileopen = GUICtrlCreateMenuItem("Open Sound",$file)
$fileexit = GUICtrlCreateMenuItem("Exit",$file)
GUISetState(@SW_SHOW)
$durata = ''


While 1        
       $msg = GUIGetMsg()
       Switch $msg
       Case $fileopen
               If FileExists($apri) Then
                       GUICtrlDelete($durata)
                       _SoundClose($apri)
               $apri = FileOpenDialog("Open Sound",@DesktopDir,'All(*.*)|Audio(*.mp3)|Audio(*.wma)|Audio(*.wav)')
                       _SoundPlay($apri)
                       $durata = GUICtrlCreateLabel("Durata: " & _SoundLength($apri,15,20)
               ElseIf Not FileExists($apri) Then
               GUICtrlDelete($durata)
               $4 = FileOpenDialog("Open Sound",@DesktopDir,'Music Files(*.mp3;*.wma;*.midi;*.wav)')
               _SoundPlay($apri)
               $durata = GUICtrlCreateLabel("Durata: " & _SoundLength($apri),15,20)
               EndIf
       Case $Fileexit
               Exit
       Case $apri
               If FileExists($apri) Then
                       GUICtrlDelete($durata)
                       _SoundClose($apri)
               $apri = FileOpenDialog("Open Sound",@DesktopDir,'All(*.*)|Audio(*.mp3)|Audio(*.wma)|Audio(*.wav)')
                       _SoundPlay($apri)
                       $durata = GUICtrlCreateLabel("Durata: " & _SoundLength($apri,15,20)
               ElseIf Not FileExists($apri) Then
               GUICtrlDelete($durata)
               $4 = FileOpenDialog("Open Sound",@DesktopDir,'Music Files(*.mp3;*.wma;*.midi;*.wav)')
               _SoundPlay($apri)
               $durata = GUICtrlCreateLabel("Durata: " & _SoundLength($apri),15,20)
               EndIf
       Case $play
               _SoundPlay($apri)
       Case $stop
               _SoundStop($apri)
       Case $pause
               _SoundPause($apri)
       Case $Gui_event_close
               Exit
               EndSwitch
       WEnd


Edited by Gianlu-thebest - 12/2/2010, 18:28
 
Top
0 replies since 7/2/2010, 10:17   83 views
  Share