Sign in to follow this  
Followers 0
bitpoint

Can't hide start button

4 posts in this topic

Hi, I'm trying to hide then show the taskbar and start button. Hiding the taskbar works fine but the start button appears immutable. I am running Win 7 64bit and I have searched the forum and tried all the code I could find.

If anyone could help I would appreciate it!

Share this post


Link to post
Share on other sites



Enum all the children of the Shell_TrayWnd class, store them in an array, hide them all, then return them all from the array when you're ready.

Or you can cheat and hope this never fails:

#include <WinAPI.au3>

__myTaskHS(True)
Sleep(3000)
__myTaskHS(False)

Func __myTaskHS($f_hide = False)
    Local $h_task = WinGetHandle("[CLASS:Shell_TrayWnd]")
    If Not $h_task Then Return SetError(1, 0, 0)

    Local $h_start = 0
    Local $a_wlist = WinList("[CLASS:Button]")
    If Not IsArray($a_wlist) Then Return SetError(2, 0, 0)

    For $iwin = 1 To $a_wlist[0][0]
        If _WinAPI_GetParent($a_wlist[$iwin][1]) = $h_task Then
            $h_start = $a_wlist[$iwin][1]
            ExitLoop
        EndIf
    Next

    If Not $h_start Then Return SetError(3, 0, 0)

    If $f_hide Then
        _WinAPI_ShowWindow($h_start, @SW_HIDE)
        _WinAPI_ShowWindow($h_task, @SW_HIDE)
    Else
        _WinAPI_ShowWindow($h_start, @SW_SHOW)
        _WinAPI_ShowWindow($h_task, @SW_SHOW)
    EndIf
EndFunc
1 person likes this

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Enum all the children of the Shell_TrayWnd class, store them in an array, hide them all, then return them all from the array when you're ready.

Or you can cheat and hope this never fails:

#include <WinAPI.au3>

__myTaskHS(True)
Sleep(3000)
__myTaskHS(False)

Func __myTaskHS($f_hide = False)
    Local $h_task = WinGetHandle("[CLASS:Shell_TrayWnd]")
    If Not $h_task Then Return SetError(1, 0, 0)

    Local $h_start = 0
    Local $a_wlist = WinList("[CLASS:Button]")
    If Not IsArray($a_wlist) Then Return SetError(2, 0, 0)

    For $iwin = 1 To $a_wlist[0][0]
        If _WinAPI_GetParent($a_wlist[$iwin][1]) = $h_task Then
            $h_start = $a_wlist[$iwin][1]
            ExitLoop
        EndIf
    Next

    If Not $h_start Then Return SetError(3, 0, 0)

    If $f_hide Then
        _WinAPI_ShowWindow($h_start, @SW_HIDE)
        _WinAPI_ShowWindow($h_task, @SW_HIDE)
    Else
        _WinAPI_ShowWindow($h_start, @SW_SHOW)
        _WinAPI_ShowWindow($h_task, @SW_SHOW)
    EndIf
EndFunc

You rock. Thanks- works perfect.

Share this post


Link to post
Share on other sites

Enum all the children of the Shell_TrayWnd class, store them in an array, hide them all, then return them all from the array when you're ready.

Or you can cheat and hope this never fails:

Excellent :-) is it possible to make it toggle between show and hide, so if it is hidden then it will be displayed and vice versa?

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  
Followers 0