Jump to content

Can't hide start button


Recommended Posts

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!

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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.
Link to comment
Share on other sites

  • 2 weeks later...

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?

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...