Anzelm Posted May 7, 2011 Share Posted May 7, 2011 (edited) 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... I'm sorry for my bad english. Edited May 7, 2011 by Anzelm Link to comment Share on other sites More sharing options...
Rogue5099 Posted May 8, 2011 Share Posted May 8, 2011 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 My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
wakillon Posted May 8, 2011 Share Posted May 8, 2011 Welcome to the AutoIt Forums ! You can lock Taskbar like this :AutoItSetOption ( "WinTitleMatchMode", 4 ) Dim $Handle = WinGetHandle ( "classname=Shell_TrayWnd" ) WinSetState ( $Handle, "", @SW_DISABLE ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
rover Posted May 8, 2011 Share Posted May 8, 2011 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 More sharing options...
Anzelm Posted May 8, 2011 Author Share Posted May 8, 2011 (edited) 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 May 8, 2011 by Anzelm Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now