Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
$hGUI2 = GUICreate('SpotifyEmbed', 800, 650, 0, 0, BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN))
$MUTE = GUICtrlCreateButton("X",110,550,60,40)
GUICtrlSetFont(-1, 30, 800, 0, "Webdings")
$PREV = GUICtrlCreateButton("3",180,550,60,40)
GUICtrlSetFont(-1, 30, 800, 0, "Webdings")
$PLAYPAUSE = GUICtrlCreateButton(";4",250,550,90,40)
GUICtrlSetFont(-1, 30, 800, 0, "Webdings")
$NEXT = GUICtrlCreateButton("4",350,550,60,40)
GUICtrlSetFont(-1, 30, 800, 0, "Webdings")
$CTRLDOWN = GUICtrlCreateButton("Vol -", 420, 550, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$CTRLUP = GUICtrlCreateButton("Vol +", 490, 550, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$CTRLP = GUICtrlCreateButton("Préf", 560, 550, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$HELP = GUICtrlCreateButton("Aide", 630, 550, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Annuler = GUICtrlCreateButton("Quitter", 700, 550, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
If ProcessExists("spotify.exe") Then ProcessClose("spotify.exe")
sleep(1000)
If Not ProcessExists("spotify.exe") Then
$pID = Run(@ProgramFilesDir&"\Spotify\spotify.exe")
WinWait("[Class:SpotifyMainWindow]")
EndIf
$hChild = WinGetHandle("Spotify")
_WinAPI_SetParent($hChild, $hGUI2)
_WinAPI_SetWindowLong($hChild, $GWL_STYLE, BitOR($WS_CLIPSIBLINGS, $WS_VISIBLE))
_WinAPI_SetWindowLong($hChild, $GWL_HWNDPARENT, $hGUI2)
WinMove($hChild, "", 0, 0)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
GUiSetState(@SW_SHOW, $hGUI2)
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ProcessClose($pID)
            Exit
        Case $Annuler
            ProcessClose($pID)
            Exit
        Case $HELP
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            send("{F1}")
        Case $CTRLP
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^{p}")
        Case $CTRLUP
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^{UP}")
        Case $CTRLDOWN
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^{DOWN}")
        Case $PREV
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^{LEFT}")
        Case $PLAYPAUSE
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("{SPACE}")
        Case $NEXT
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^{RIGHT}")
        Case $MUTE
            WinActivate($hChild,"")
            Opt("SendKeyDownDelay", 50)
            Send("^+{DOWN}")
    EndSwitch
WEnd