Jump to content
Sign in to follow this  
Terenz

Taskbar problems

Recommended Posts

Terenz

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:

2r5teva.jpg

So the question is:

How to really hide the taskbar and make that space usable?

Thanks for any help

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites
Danyfirex

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

Share this post


Link to post
Share on other sites
Terenz

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

 

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Danyfirex

Sorry. ¬¬ I only tried to help. 

Share this post


Link to post
Share on other sites
Terenz

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 :sweating:
 
@Danyfirex don't sorry, i'll apprecciate any type of help ;)

Edited by Terenz
  • Like 1

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites
Terenz

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 by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites
Terenz

For intrested, this is a C# of what i'll try to reproduce

Source: Stackoverflow

[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 by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites
Danyfirex

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

Share this post


Link to post
Share on other sites
timmy2

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.

Share this post


Link to post
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
Sign in to follow this  

×