Code : Tout sélectionner
#NoTrayIcon
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#Include <Misc.au3>
#include <GDIPlus.au3>; this is where the magic happens, people
Hotkeyset("{F4}", "CODE2")
ProcessClose("mouse.exe")
$nomlogic = "Darkex'Dock V1.0 bêta"
$Xresol=@DesktopWidth
$Yresol=@DesktopHeight
$GUI = GUICreate($nomlogic, 158,190, $Xresol-158, 0,$WS_POPUP)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
$Button1 = GUICtrlCreateButton("Firefox Pwnage", 5, 30, 110, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("-", 140, 1, 18, 18, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Fermer Darkex'Dock", 5, 160, 150, 25, $WS_GROUP)
Dim $u[21]
$u[0] = 20 ; Nombre de cases
For $i = 1 To $u[0]
Local $col = Mod($i-1, 5) ; 5 cases par ligne
Local $row = ($i-1-$col)/5 ; quand on sait la colonne, on trouve la ligne
$u[$i] = GUICtrlCreateButton("u"&$i, 16+26*$col, 55+26*$row, 26, 26, BitOR($BS_BITMAP,$WS_GROUP))
GUICtrlSetImage(-1, @ScriptDir & "\images\u"&$i&".bmp", -1)
ControlHide($nomlogic, "", $u[$i])
Next
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\images\1655.bmp", 16, 55, 131, 105, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
Global $LISTE = @ScriptDir & "\option.txt"
;INIT
Dim $p[22]
$p[0] = 21 ; Nombre de cases
For $i = 1 To $p[0]
$p[$i] = FileReadLine($LISTE,$i) ;r101
Next
;INIT
GUISetState(@SW_HIDE)
$colorf = "0x000000"
$color = "0xffffff"
$Label1 = GUICtrlCreateLabel("x , y", 66, 20, 70, 17)
GUICtrlSetColor ($Label1,$color)
$Label2 = GUICtrlCreateLabel("- Darkex'dock -", 8, 6, 90, 17)
GUICtrlSetColor ($Label2,$color)
$fois = $p[21]
$Label3 = GUICtrlCreateLabel("x " & $fois, 125, 35, 20, 17)
GUICtrlSetColor ($Label3,$color)
GUISetBkColor($colorf,$GUI)
$acti = 0
$Pipi = GUICtrlCreatePic(@ScriptDir & "\images\fond.bmp", 0, 0, 158, 190, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
Run(@ScriptDir & "\mouse.exe")
While 1
$nMsg = GUIGetMsg()
$x = MouseGetPos(0)
$y = MouseGetPos(1)
GUICtrlDelete($Label1)
$Label1 = GUICtrlCreateLabel($x & " , " & $y, 85, 6, 55, 17)
GUICtrlSetColor ($Label1,$color)
Sleep(10)
If $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Button3 Then
ProcessClose("mouse.exe")
Exit
Endif
If $nMsg = $Button2 Then
GUISetState(@SW_HIDE)
$acti = 0
Endif
If $nMsg = $Button1 Then
If ProcessExists("firefox.exe") Then
GUICtrlDelete($Label3)
$fois = $fois + 1
$x = $fois
_FileWriteToLine($LISTE, 21, $x, 1)
$Label3 = GUICtrlCreateLabel("x " & $fois, 125, 35, 20, 17)
GUICtrlSetColor ($Label3,$color)
ProcessClose("firefox.exe")
Else
Msgbox(1,"Firefox n'est pas lancé","Firefox n'est pas lancé.")
EndIf
Endif
For $i = 1 To $u[0]
If $nMsg = $u[$i] Then
If $p[$i] = "Rien" Then
msgbox(1,"Ajouter","Modifier le fichier option.txt ligne "&$i)
Else
Run($p[$i])
Endif
Endif
Next
If $acti = 0 Then
If $x > $Xresol-157 AND $x < $Xresol-1 AND $y = 0 Then
$acti = 1
GUISetState(@SW_SHOW)
Endif
Else
If $x > $Xresol-157 AND $x <= $Xresol AND $y >= 0 AND $y < 189 Then
;si open
;If $x > 1298 AND $x < 1428 AND $y > 55 AND $y < 159 Then
;TOUT LE CARRé !
;Endif
For $i = 1 To $u[0]
Local $col = Mod($i-1, 5) ; 5 cases par ligne
Local $row = ($i-1-$col)/5 ; quand on sait la colonne, on trouve la ligne
If $x > $Xresol-142+26*$col AND $x < $Xresol-116+26*$col AND $y > 55+26*$row AND $y < 81+26*$row Then
ControlShow($nomlogic, "", $u[$i])
Else
ControlHide($nomlogic, "", $u[$i])
Endif
Next
Else
GUISetState(@SW_HIDE)
$acti = 0
Endif
Endif
WEnd
Func CODE2()
Exit
EndFunc ;==>CODE2
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST