monitor25 Posted December 16, 2016 Share Posted December 16, 2016 The code above doesn't work when the wanted ToolTip has ButtonNumber = 0. The Get_Systray_Index function returns 0, so the "Icon not found in system tray" error message appears. I have modified the code slightly: expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = -1 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip $fToolTipFound = False For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 $sButtonText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber) If StringInStr($sButtonText, $sToolTipTitle) = 1 Then $fToolTipFound = True ExitLoop EndIf Next If $fToolTipFound = False Then Return -1 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Link to comment Share on other sites More sharing options...
war59312 Posted December 28, 2016 Share Posted December 28, 2016 Not working on Windows 10 x64 it seems. Googling a bit.. Says replace "Instance:1" with "instance:2", but then I get "No items found in system tray" error. Link to comment Share on other sites More sharing options...
monitor25 Posted March 20, 2017 Share Posted March 20, 2017 On 28/12/2016 at 6:32 PM, war59312 said: Not working on Windows 10 x64 it seems. Googling a bit.. Says replace "Instance:1" with "instance:2", but then I get "No items found in system tray" error. There are two ToolbarWindow32 sub-classes in the Shell_TrayWnd class. We need the "User Promoted Notification Area" one. So use the following code $hSysTray_Handle = ControlGetHandle("[Class:Shell_TrayWnd]", "", "User Promoted Notification Area") Compile X64 version and use it in Windows 10 (works in Window 7 as well). psbeau and Decibel 1 1 Link to comment Share on other sites More sharing options...
NassauSky Posted March 25 Share Posted March 25 7 year old post... If by chance you have information on that treeview process explorer (with handles) in the previous post, I'd be very interested. Thanks! 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