Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created January 14, 2013 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kissgyorgy/4531556 to your computer and use it in GitHub Desktop.
Save kissgyorgy/4531556 to your computer and use it in GitHub Desktop.
AutoIt: Lock/Unlock Windows taskbar in Windows 7
#include <WinAPI.au3>
#include <WindowsConstants.au3>
$iPrevState = LockTaskBar(1)
Func LockTaskBar($iLock)
41If @OSVersion <> "WIN_7" Then
MsgBox(16,"Onyl on Windows 7", "The taskbar can only be locked this way in Windows 7 !")
Return
EndIf
Local $iPrevState = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove")
$hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
If _WinAPI_GetClassName($hTrayWnd) <> "Shell_TrayWnd" Then Exit
If $iPrevState = $iLock Then _SendMessage($hTrayWnd, $WM_COMMAND, 424, 0)
Return 1-$iPrevState
EndFunc ;==>LockTaskBar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment