;==[Les Includes]====
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
;==[Déclaration des variables Globale & Autres]====
Global $hGUI
Global $Taskbar = ""
;==[Taille de la barre de tâches pour définir taille de mon GUI]====
Global $aPos = WinGetPos("[CLASS:Shell_TrayWnd]")
Global $Left = $aPos[0]
Global $Right = $aPos[1]
Global $Width = $aPos[2]
Global $Height = $aPos[3]
;==[Détermination de la position de la barre de tâche]====
;Barre de tâche en bas de l'écran
If $Left = 0 And $Width = @DesktopWidth And $Right = (@DesktopHeight - $aPos[3]) Then
$Right = (@DesktopHeight - $aPos[3])
$Taskbar = 1
ConsoleWrite("$TaskbarIsDown" & @CRLF)
EndIf
;Barre de tâche en haut de l'écran
If $Left = 0 And $Width = @DesktopWidth And $Right = 0 Then
$Taskbar = 2
ConsoleWrite("$TaskbarIsUp" & @CRLF)
EndIf
;Barre de tâche à gauche de l'écran
If $Left = 0 And $Right = 0 And $Height = @DesktopHeight Then
$Taskbar = 3
ConsoleWrite("$TaskbarIsLeft" & @CRLF)
EndIf
;Barre de tâche à droite de l'écran
If $Left <> 0 And $Right = 0 And $Height = @DesktopHeight Then
$Taskbar = 4
ConsoleWrite("$TaskbarIsRight" & @CRLF)
EndIf
;Barre de tâche masquée
If $Left = 0 And $Width = @DesktopWidth And $Right = @DesktopHeight - 2 Then
$Taskbar = 5
ConsoleWrite("$TaskbarIsHidden" & @CRLF)
EndIf
_LoadAll()
Func _LoadAll()
;Création de mon GUI en fonction de la position de ma barre de tâche
Select
Case $Taskbar = 1
$hGUI = GUICreate("Down", $Width - 15, ($Right - 48) + 5, 5, 5)
Case $Taskbar = 2
$hGUI = GUICreate("Up", $Width - 15, @DesktopHeight - $Height - 48 + 5, 5, $Height + 5)
Case $Taskbar = 3
$hGUI = GUICreate("Left", @DesktopWidth - $Width - 15, $Height - 44, $Width + 5, 5)
Case $Taskbar = 4
$hGUI = GUICreate("Right", @DesktopWidth - $Width - 15, $Height - 44, 5, 5)
Case $Taskbar = 5
$hGUI = GUICreate("Hidden", @DesktopWidth- 15, @DesktopHeight - $Height, 5, 5)
EndSelect
GUISetState (@SW_SHOW)
GUIRegisterMsg($WM_WINDOWPOSCHANGING, 'WM_WINDOWPOSCHANGING')
WinSetOnTop($hGUI,"",1)
EndFunc
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
While GUIGetMsg() <> -3
WEnd
Func WM_WINDOWPOSCHANGING($hWnd, $iMsg, $wParam, $lParam)
#forceref $iMsg, $wParam, $lParam
Local $aWinGetPos = WinGetPos($hWnd)
If @error Or $aWinGetPos[0] < -30000 Then Return $GUI_RUNDEFMSG
Local $tWindowPos = DllStructCreate($tagWINDOWPOS, $lParam)
DllStructSetData($tWindowPos, 'X', $aWinGetPos[0])
DllStructSetData($tWindowPos, 'Y', $aWinGetPos[1])
Return $GUI_RUNDEFMSG
EndFunc
Modifié en dernier par Hugues le mer. 13 nov. 2013 12:20, modifié 1 fois.
#include <GUIConstantsEx.au3>
Global $hGUI
Global $Taskbar = ""
Global $hGUI = GUICreate("Window", @DesktopWidth, @DesktopHeight, 0, 0)
GUISetState ()
AdlibRegister("_moveGui")
WinSetOnTop($hGUI,"",1)
Func _moveGui()
;==[Taille de la barre de tâches pour définir taille de mon GUI]====
Local $aPos = WinGetPos("[CLASS:Shell_TrayWnd]")
Local $left = $aPos[0]
Local $top = $aPos[1]
Local $Width = $aPos[2]
Local $Height = $aPos[3]
Local $w, $h, $x, $y
;==[Détermination de la position de la barre de tâche]====
;Barre de tâche en bas de l'écran
If $left = 0 And $Width = @DesktopWidth And $top = (@DesktopHeight - $aPos[3]) Then
$w = $width - 10
$h = @DesktopHeight - $height - 10
$x = 5
$y = 5
EndIf
;Barre de tâche en haut de l'écran
If $left= 0 And $Width = @DesktopWidth And $top = 0 Then
$w = $width - 10
$h = @DesktopHeight - $Height - 10
$x = 5
$y = $Height + 5
EndIf
;Barre de tâche à gauche de l'écran
If $left= 0 And $top = 0 And $Height = @DesktopHeight Then
$w = @DesktopWidth - $Width - 10
$h = $Height - 10
$x = $Width + 5
$y = 5
EndIf
;Barre de tâche à droite de l'écran
If $left <> 0 And $top = 0 And $Height = @DesktopHeight Then
$w = @DesktopWidth - $Width - 10
$h = $Height - 10
$x = 5
$y = 5
EndIf
;Barre de tâche masquée
If $left= 0 And $Width = @DesktopWidth And $top = @DesktopHeight - 2 Then
$w = @DesktopWidth - 10
$h = @DesktopHeight - 10
$x = 5
$y = 5
EndIf
Local $aGuiPos = WinGetPos($hGui)
If $aGuiPos[0] <> $x OR $aGuiPos[1] <> $y OR $aGuiPos[2] <> $w OR $aGuiPos[3] <> $h Then WinMove($hGui, "", $x, $y, $w, $h)
EndFunc
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Le script, ça fait gagner beaucoup de temps... à condition d'en avoir beaucoup devant soi !