Jump to content

Recommended Posts

Posted (edited)

I was wondering how to get all the registered taskbar buttons that appear between the startbutton and the tray.

$hWnd_Tray_Toolbar = ControlGetHandle ($hWnd_Tray,'','[CLASS:ToolbarWindow32; INSTANCE:2]')
$temp = _GUICtrlToolbar_ButtonCount($hWnd_Tray_Toolbar)
Dim $Text[$temp]
For $1 = 0 To UBound ($Text) - 1
$Text[$1] = _GUICtrlToolbar_GetButtonText($hWnd_Tray_Toolbar, _GUICtrlToolbar_IndexToCommand($hWnd_Tray_Toolbar,$1))
Next

(this isn't a working example i know... but the rest of the code isn't relative.. and choppy i'll organize it when i get this part working.)

this brings up buttons but some of them aren't visible...

(ex)

-wExplorer & G:\Scripts\Startbar

-Safari & Facebook | Home

-SciTE & G:\Scripts\Startbar\Startbar.au3

ect....

they bring up more than the actual visible buttons. i was wondering, if there was a certain way to get the registered buttons on the Bar and get the text of them?

Edited by CodyBarrett
Posted
  • Moderators
Posted

CodyBarrett,

Check whether the button has the $TBSTATE_HIDDEN state. The following only lists the visible buttons on my system:

#include <GuiToolBar.au3>

$hWnd_Tray_Toolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[CLASS:ToolbarWindow32; INSTANCE:4]')
$iCount = _GUICtrlToolbar_ButtonCount($hWnd_Tray_Toolbar)

For $i = 1 To $iCount
    $iCmdID =  _GUICtrlToolbar_IndexToCommand($hWnd_Tray_Toolbar, $i)
    $iState = _GUICtrlToolbar_GetButtonState($hWnd_Tray_Toolbar, $iCmdID)
    If BitAnd($iState, $TBSTATE_HIDDEN) <> $TBSTATE_HIDDEN Then
        $sText = _GUICtrlToolbar_GetButtonText($hWnd_Tray_Toolbar, $iCmdID)
        ConsoleWrite($sText & @CRLF)
    EndIf
Next

You may need to change the INSTANCE value to get the TaskBar handle - I am running Vista and I know that value varies between OSs. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Posted

CodyBarrett,

Check whether the button has the $TBSTATE_HIDDEN state. The following only lists the visible buttons on my system:

#include <GuiToolBar.au3>

$hWnd_Tray_Toolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[CLASS:ToolbarWindow32; INSTANCE:4]')
$iCount = _GUICtrlToolbar_ButtonCount($hWnd_Tray_Toolbar)

For $i = 1 To $iCount
    $iCmdID =  _GUICtrlToolbar_IndexToCommand($hWnd_Tray_Toolbar, $i)
    $iState = _GUICtrlToolbar_GetButtonState($hWnd_Tray_Toolbar, $iCmdID)
    If BitAnd($iState, $TBSTATE_HIDDEN) <> $TBSTATE_HIDDEN Then
        $sText = _GUICtrlToolbar_GetButtonText($hWnd_Tray_Toolbar, $iCmdID)
        ConsoleWrite($sText & @CRLF)
    EndIf
Next

You may need to change the INSTANCE value to get the TaskBar handle - I am running Vista and I know that value varies between OSs. :mellow:

M23

wow. i didn't even think of getting the State of the tool bar. :( thank you so much! Ps. I'm only using it on XP for now.

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
×
×
  • Create New...