Jump to content

Lock taskbar


Recommended Posts

ControlCommand("[CLASS:Shell_TrayWnd]", "", "[CLASS:ToolbarWindow32]", "SendCommandID", 424)

Where is the problem, in this Line? I want to lock or unlock the taskbar, but i cant do it.

$retval = DllCall("user32.dll","hwnd","FindWindow","str","Shell_TrayWnd","str","")

if @error then

MsgBox(0,"ERROR","DLLCALL error")

exit

endif

$tray_handle = $retval[0]

MsgBox(0,"TRAY Handle",String($tray_handle))

$tray_handle = WinGetHandle("Shell_TrayWnd")

;$tray_handle = WinGetHandle("classname=Shell_TrayWnd")

ControlCommand("[CLASS:Shell_TrayWnd]", "", "[CLASS:ToolbarWindow32; INSTANCE:3]", "SendCommandID", 424)

This script first show a window, with the number of Taskbar's handle. But it's doesn't matter. After this, i want to send a command, but it's will be crashed the Explorer.exe. Whats wrong in my script? Please help! I begin to try to do it three days ago. I search a lot of thinks with the Google, how to do it with other computer programming language, but i can't do it with Autoit. I tried a lot of combinations, my most success is the crash, because it's the one signal: maybe i sent a message to the Explorer... :unsure:

I'm sorry for my bad english.

Edited by Anzelm
Link to comment
Share on other sites

Windows 7 Lock:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarSizeMove"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarSizeMove"=-

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"LockTaskbar"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"LockTaskbar"=-

Windows 7 Unlock:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarSizeMove"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarSizeMove"=-

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"LockTaskbar"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"LockTaskbar"=-

Windows Vista Lock Unlock:

Vista Lock Unlock Taskbar

Link to comment
Share on other sites

I think this is what the OP is looking for

#Include <WinAPI.au3>
#include <WindowsConstants.au3>
Local $sLockTaskbar = 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 $sLockTaskbar = 1 Then _SendMessage($hTrayWnd, $WM_COMMAND, 424, 0)

I see fascists...

Link to comment
Share on other sites

I think this is what the OP is looking for

#Include <WinAPI.au3>
#include <WindowsConstants.au3>
Local $sLockTaskbar = 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 $sLockTaskbar = 1 Then _SendMessage($hTrayWnd, $WM_COMMAND, 424, 0)

I dont know, what can i say to you. Because it's awesome! I want first just unlock the taskbar, but this code is good for it too, because the WM_COMMAND code is same for it. And now, i just have to change the number after the $sLockTaskbar, replace 1 with 0. So finally: thank you, thank you, thank you!!!

Edited by Anzelm
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...