Code : Tout sélectionner
; Script testé sur Windows 7, Windows 8.1 et Windows 10
; Source : http://www.sevenforums.com/tutorials/1066-taskbar-move-location-desktop-screen.html
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
GUICreate("TaskBar Mover", 280, 390, 190, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlCreateButton("Top", 65, 45, 145, 50)
GUICtrlSetOnEvent(-1, "Btn_TopClick")
GUICtrlCreateButton("Right", 210, 70, 50, 160)
GUICtrlSetOnEvent(-1, "Btn_RightClick")
GUICtrlCreateButton("Left", 15, 70, 50, 160)
GUICtrlSetOnEvent(-1, "Btn_LeftClick")
GUICtrlCreateButton("Bottom", 65, 205, 145, 50)
GUICtrlSetOnEvent(-1, "Btn_BottomClick")
GUICtrlCreateButton("AutoHide On", 70, 270, 70, 25)
GUICtrlSetOnEvent(-1, "Btn_AutoHideOn")
GUICtrlCreateButton("AutoHide Off", 140, 270, 70, 25)
GUICtrlSetOnEvent(-1, "Btn_AutoHideOff")
GUICtrlCreateButton("Lock On", 70, 305, 70, 25)
GUICtrlSetOnEvent(-1, "Btn_LockOn")
GUICtrlCreateButton("Lock Off", 140, 305, 70, 25)
GUICtrlSetOnEvent(-1, "Btn_LockOff")
GUICtrlCreateButton("Quit", 102, 350, 75, 25)
GUICtrlSetOnEvent(-1, "Quit")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Btn_BottomClick()
_MoveTaskBar("Bottom")
EndFunc ;==>Btn_BottomClick
Func Btn_RightClick()
_MoveTaskBar("Right")
EndFunc ;==>Btn_RightClick
Func Btn_LeftClick()
_MoveTaskBar("Left")
EndFunc ;==>Btn_LeftClick
Func Btn_TopClick()
_MoveTaskBar("Top")
EndFunc ;==>Btn_TopClick
Func Btn_AutoHideOn()
_MoveTaskBar(-1, 1, -1)
EndFunc ;==>Btn_AutoHideOn
Func Btn_AutoHideOff()
_MoveTaskBar(-1, 0, -1)
EndFunc ;==>Btn_AutoHideOff
Func Btn_LockOn()
_MoveTaskBar(-1, -1, 1)
EndFunc ;==>Btn_LockOn
Func Btn_LockOff()
_MoveTaskBar(-1, -1, 0)
EndFunc ;==>Btn_LockOff
Func Quit()
Exit
EndFunc ;==>Quit
; #FUNCTION# ====================================================================================================================
; Name ..........: _MoveTaskBar
; Description ...: Moves the Windows Taskbar to a New Location on the Screen.
; Syntax ........: _MoveTaskBar([$ScreenPos [, $iAutoHide = Default [, $iLock = Default]]])
; Parameters ....: $ScreenPosX = Left, Right, Top, Bottom or -1 if you want to keep actual position (default value Bottom)
; $iAutoHide = 0, 1 or -1 if you want to keep actual value (default value -1)
; $iLock = 0, 1 or -1 if you want to keep actual value (default value -1)
; Return values .: Success - True
; Failure - False and set @error = 1
; Author ........: Tlem
; Remarks .......: Tested on windows XP, 7, 8.1 and 10
; Example .......:
; Note ..........:
; ===============================================================================================================================
Func _MoveTaskBar($ScreenPos = "Bottom", $iAutoHide = -1, $iLock = -1)
Local $StuckRects = (@OSVersion = "WIN_10") ? "StuckRects3" : "StuckRects2"
Local $sStuckRectsHKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\" & $StuckRects
Local $sLockHKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\"
$iAutoHide = ($iAutoHide = -1) ? StringMid(RegRead($sStuckRectsHKey, "Settings"), 19, 2) : (($iAutoHide = 0) ? "02" : "03")
$iLock = ($iLock = -1) ? RegRead($sLockHKey, "TaskbarSizeMove") : (($iLock = 1) ? 0x00 : 0x01)
Select
Case $ScreenPos = "Bottom"
$ScreenPos = "0x28000000ffffffff02000000030000003e0000002e000000000000008204000080070000b0040000"
Case $ScreenPos = "Left"
$ScreenPos = "0x28000000ffffffff02000000000000003e0000002e00000000000000000000003e000000b0040000"
Case $ScreenPos = "Right"
$ScreenPos = "0x28000000ffffffff02000000020000003e0000002e000000420700000000000080070000b0040000"
Case $ScreenPos = "Top"
$ScreenPos = "0x28000000ffffffff02000000010000003e0000002e0000000000000000000000800700002e000000"
Case $ScreenPos = -1
$ScreenPos = RegRead($sStuckRectsHKey, "Settings")
Case Else
Return SetError(1, 0, 0)
EndSelect
$ScreenPos = StringMid($ScreenPos, 1, 18) & $iAutoHide & StringMid($ScreenPos, 21)
; Write new keys
RegWrite($sStuckRectsHKey, "Settings", "REG_BINARY", $ScreenPos)
RegWrite($sLockHKey, "TaskbarSizeMove", "REG_DWORD", $iLock)
; Restart Explorer
$Kernel32 = DllOpen("kernel32.dll")
$hproc = DllCall($Kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', True, 'int', ProcessExists('explorer.exe'))
DllCall($Kernel32, "int", "TerminateProcess", "int", $hproc[0], "dword", 0)
DllClose($Kernel32)
Return 1
EndFunc ;==>MoveTaskBar