Terenz Posted September 4, 2013 Share Posted September 4, 2013 (edited) Hi guys, I need to hide the taskbar when i open a default folder with autoit. Searching on the forum i have found many method, ControlHide + @SW_HIDE, _WinAPI_FindWindow + @SW_HIDE, WinSetTrans at 0. Everyone work but only in theory, the taskbar is hidden but when i open the folder i have this: So the question is: How to really hide the taskbar and make that space usable? Thanks for any help Edited September 4, 2013 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Danyfirex Posted September 4, 2013 Share Posted September 4, 2013 Maybe this can Help. #include <WinAPI.au3> #include <WindowsConstants.au3> $iPrevState = LockTaskBar(1) Func LockTaskBar($iLock) If @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 saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Terenz Posted September 4, 2013 Author Share Posted September 4, 2013 In what way that script can help? I need to hide the taskbar without that hole, not lock it Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2013 Moderators Share Posted September 4, 2013 Terenz,Search the forum for the DLL call "SetWorkArea" - it tells Windows how big an area it can cover and ususally excludes the taskbar, even if it is hidden. There is another DLL call "GetWorkArea" which will give you the coordinates needed when you reset the size later. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Danyfirex Posted September 4, 2013 Share Posted September 4, 2013 Sorry. ¬¬ I only tried to help. Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Terenz Posted September 4, 2013 Author Share Posted September 4, 2013 (edited) Hi Melba, that is a workaround of the problem, make the folder bigger instead of use maximize on the folder. I don't belive there isn't a way to hide taskbar like Windows do with auto-hide @Danyfirex don't sorry, i'll apprecciate any type of help Edited September 4, 2013 by Terenz Danyfirex 1 Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Terenz Posted September 4, 2013 Author Share Posted September 4, 2013 (edited) Ok, the "best-correct method" to automate the taskbar is to use: SHAppBarMessage I don't have found an example for add a newstatus to the taskbar, only for retrive information. My idea was autohide the taskbar ( so the window can be maximized correclty ) using ABM_SETAUTOHIDEBAR and maybe send always hide so if the mouse go over it the taskbar will not appear...this on paper. Someone can help me with this? Thanks Edited September 4, 2013 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Terenz Posted September 4, 2013 Author Share Posted September 4, 2013 (edited) For intrested, this is a C# of what i'll try to reproduce Source: Stackoverflow expandcollapse popup[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr FindWindow(string strClassName, string strWindowName); [DllImport("shell32.dll")] public static extern UInt32 SHAppBarMessage(UInt32 dwMessage, ref APPBARDATA pData); public enum AppBarMessages { New = 0x00000000, Remove = 0x00000001, QueryPos = 0x00000002, SetPos = 0x00000003, GetState = 0x00000004, GetTaskBarPos = 0x00000005, Activate = 0x00000006, GetAutoHideBar = 0x00000007, SetAutoHideBar = 0x00000008, WindowPosChanged = 0x00000009, SetState = 0x0000000a } [StructLayout(LayoutKind.Sequential)] public struct APPBARDATA { public UInt32 cbSize; public IntPtr hWnd; public UInt32 uCallbackMessage; public UInt32 uEdge; public Rectangle rc; public Int32 lParam; } public enum AppBarStates { AutoHide = 0x00000001, AlwaysOnTop = 0x00000002 } /// <summary> /// Set the Taskbar State option /// </summary> /// <param name="option">AppBarState to activate</param> public void SetTaskbarState(AppBarStates option) { APPBARDATA msgData = new APPBARDATA(); msgData.cbSize = (UInt32)Marshal.SizeOf(msgData); msgData.hWnd = FindWindow("System_TrayWnd", null); msgData.lParam = (Int32)(option); SHAppBarMessage((UInt32)AppBarMessages.SetState, ref msgData); } /// <summary> /// Gets the current Taskbar state /// </summary> /// <returns>current Taskbar state</returns> public AppBarStates GetTaskbarState() { APPBARDATA msgData = new APPBARDATA(); msgData.cbSize = (UInt32)Marshal.SizeOf(msgData); msgData.hWnd = FindWindow("System_TrayWnd", null); return (AppBarStates)SHAppBarMessage((UInt32)AppBarMessages.GetState, ref msgData); When the code above is implemented just set the Taskbar to autohide by: SetTaskbarState(AppBarStates.AutoHide); Get the current state by: AppBarStates currentState = GetTaskbarState(); #END I have found also a very old library ( 2006 ) in autoit, called >AppBar UDF. Inside there is a Func called _AppbarAutoHideBarSet, but seems not work, maybe need an update? With my limited knowledge i don't think i can be useful for accomplish this, waiting for someone i'll continue to search and if i'll found something i'll post here. Edited September 4, 2013 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Danyfirex Posted September 4, 2013 Share Posted September 4, 2013 For autoHide this work. Global Const $ABS_AUTOHIDE = 0x1 Global $pabd = DllStructCreate("dword;int;uint;uint;int;int;int;int;int") DllStructSetData($pabd,1,DllStructGetSize($pabd)) ;cbSize DllStructSetData($pabd,2,ControlGetHandle("Start","","Shell_TrayWnd")) ;hWnd DllStructSetData($pabd,9,$ABS_AUTOHIDE) ;????,??????? SHAppBarMessage($ABM_SETSTATE,$pabd) ;??ABM_SETSTATE?????? Func SHAppBarMessage($Message,ByRef $pabd) $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$Message,"ptr",DllStructGetPtr($pabd)) If Not @error Then If $lResult[0] Then Return $lResult[0] EndIf EndIf SetError(1) Return False EndFunc saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
timmy2 Posted October 24, 2013 Share Posted October 24, 2013 For autoHide this work. Global Const $ABS_AUTOHIDE = 0x1 Global $pabd = DllStructCreate("dword;int;uint;uint;int;int;int;int;int") DllStructSetData($pabd,1,DllStructGetSize($pabd)) ;cbSize DllStructSetData($pabd,2,ControlGetHandle("Start","","Shell_TrayWnd")) ;hWnd DllStructSetData($pabd,9,$ABS_AUTOHIDE) ;????,??????? SHAppBarMessage($ABM_SETSTATE,$pabd) ;??ABM_SETSTATE?????? Func SHAppBarMessage($Message,ByRef $pabd) $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$Message,"ptr",DllStructGetPtr($pabd)) If Not @error Then If $lResult[0] Then Return $lResult[0] EndIf EndIf SetError(1) Return False EndFunc saludos Won't compile without error. Below "SHAppBarMessage($ABM_SETSTATE,$pabd)" it says "$ABM_SETSTATE: possibly used before declaration, undeclared global variable. Link to comment Share on other sites More sharing options...
sylremo Posted April 28, 2023 Share Posted April 28, 2023 (edited) Apologizing for bumping an old post, I just want to provide a cleaner snippet, which is more intuitive based on MSDOC's APPBARDATA: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-appbardata ToggleTaskbarAutoHide() MsgBox(262144, '', 'Taskbar autohide toggled') ToggleTaskbarAutoHide() Func ToggleTaskbarAutoHide() Local Const $ABM_GETSTATE = 0x00000004 Local Const $ABM_SETSTATE = 0x0000000A Local Const $ABS_AUTOHIDE = 0x00000001 Local Const $ABS_ALWAYSONTOP = 0x00000002 Local $tAPPBARDATA = DllStructCreate('dword;int;uint;uint;int[4];int') DllStructSetData($tAPPBARDATA, 1, DllStructGetSize($tAPPBARDATA)) DllStructSetData($tAPPBARDATA, 2, WinGetHandle('[CLASS:Shell_TrayWnd]')) Local $iCurrentState = DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_GETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) Local $iNewState = $iCurrentState[0] ? $ABS_ALWAYSONTOP : $ABS_AUTOHIDE DllStructSetData($tAPPBARDATA, 6, $iNewState) DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) EndFunc Edited April 29, 2023 by sylremo ioa747 and Danyfirex 2 Link to comment Share on other sites More sharing options...
ioa747 Posted November 16 Share Posted November 16 (edited) @sylremo thank you for this I modified it according to my needs expandcollapse popup; https://www.autoitscript.com/forum/topic/154281-taskbar-problems/?do=findComment&comment=1517375 ; FileVersion:3, Testet on Win10 22H2, with AutoIt Version:3.3.16.1 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;~ #AutoIt3Wrapper_UseX64=y ConsoleWrite("TaskbarState=" & TaskbarState() & @CRLF) ; #FUNCTION# -------------------------------------------------------------------------------------------------------------------- ; Name...........: TaskbarState ; Description....: Sets or gets the state of the taskbar. ; Syntax.........: TaskbarState([$iState]) ; Parameters.....: $iState - [optional] The new state of the taskbar. Can be one of the following values: ; 1 - Auto-hide the taskbar. ; 2 - Always on top. ; 3 - Toggle the current state of the taskbar. ; Return values..: The current state of the taskbar. Can be one of the following values: ; Success: 1 = Auto-hide, 2 = Always on top. ; Failure: 0 and sets the @error flag to non-zero. ; Author ........: sylremo, mod:ioa747 ; Notes .........: if no value in $iState then return the state of the taskbar ; Link ..........: https://www.autoitscript.com/forum/topic/154281-taskbar-problems/#comment-1538596 ;-------------------------------------------------------------------------------------------------------------------------------- Func TaskbarState($iState = "") Local Const $ABM_GETSTATE = 0x00000004 Local Const $ABM_SETSTATE = 0x0000000A Local Const $ABS_AUTOHIDE = 0x00000001 Local Const $ABS_ALWAYSONTOP = 0x00000002 Local $tAPPBARDATA = DllStructCreate('dword;hwnd;dword;dword;int[4];dword') DllStructSetData($tAPPBARDATA, 1, DllStructGetSize($tAPPBARDATA)) Local $iCurrentState = DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_GETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) If Not @error And IsArray($iCurrentState) Then Local $iNewState = $iCurrentState[0] ? $ABS_ALWAYSONTOP : $ABS_AUTOHIDE DllStructSetData($tAPPBARDATA, 6, $iNewState) $iCurrentState = $iCurrentState[0] = 1 ? 1 : 2 If $iState = 1 Or $iState = 2 Then If $iCurrentState <> $iState Then DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) $iCurrentState = $iNewState EndIf ElseIf $iState = 3 Then DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) $iCurrentState = $iNewState EndIf Return $iCurrentState EndIf Return SetError(1, 0, 0) EndFunc ;==>TaskbarState Thanks to @argumentum it now also works on x64 Thanks to @Nine I removed the unnecessary call DllStructSetData() Edited November 17 by ioa747 removed the unnecessary call DllStructSetData() argumentum 1 I know that I know nothing Link to comment Share on other sites More sharing options...
argumentum Posted November 17 Share Posted November 17 On 9/4/2013 at 2:43 PM, Danyfirex said: For autoHide this work. Works just fine in x32, could you fix it to work for x64 ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted November 17 Share Posted November 17 ..never mind. had to be DllStructCreate("dword;hwnd;dword;dword;int[4];dword") Danyfirex and ioa747 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
ioa747 Posted November 17 Share Posted November 17 @argumentum Thank you, now also works on x64 I filled in something else that was missing $iCurrentState = $iNewState ;*** <--- that was missing If $iState = 1 Or $iState = 2 Then If $iCurrentState <> $iState Then DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) $iCurrentState = $iNewState ;*** <--- that was missing EndIf ElseIf $iState = 3 Then DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA)) $iCurrentState = $iNewState EndIf argumentum 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Nine Posted November 17 Share Posted November 17 (edited) Based on MSDN for ABM_GETSTATE message : Quote Pointer to an APPBARDATA structure. You must specify the cbSize member when sending this message; all other members are ignored. Tested (x86, x64) without : DllStructSetData($tAPPBARDATA, 2, WinGetHandle('[CLASS:Shell_TrayWnd]')) And it is working just fine. Not a big deal, but I was doubtful on why we would need to provide this information. Edited November 17 by Nine precision ioa747 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ioa747 Posted November 17 Share Posted November 17 @Nine thanks for sharing I removed the unnecessary call DllStructSetData() I updated it above Nine 1 I know that I know nothing 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