Exit Posted December 22, 2012 Share Posted December 22, 2012 (edited) Edit: @KaFu solved it. Thanks. ############################################################ Here is Kafu's code. See 14 posts below. Func _TraySetToolTip_Ex($sText = "") ; #include "_TraySetToolTip_Ex.au3" ; http://www.autoitscript.com/forum/index.php?showtopic=146910 If Not $sText Then $sText = Chr(0) ; Chr(0) = no tooltip displayed TraySetToolTip($sText) Local $_SysTray_hToolTip = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", ControlGetHandle(ControlGetHandle(ControlGetHandle(WinGetHandle("[CLASS:Shell_TrayWnd]"), "", "[CLASS:TrayNotifyWnd]"), "", "[CLASS:SysPager]"), "", "[CLASS:ToolbarWindow32; INSTANCE:1]"), "uint", 0x423, "wparam", 0, "lparam", 0) ; $TB_GETTOOLTIPS = 0x423 $_SysTray_hToolTip = HWnd($_SysTray_hToolTip[0]) If Not IsHWnd($_SysTray_hToolTip) Or WinGetTitle($_SysTray_hToolTip) <> $sText Then Return DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $_SysTray_hToolTip, "uint", 0x41D, "wparam", 0, "lparam", 0) ; $TTM_UPDATE = 0x41D EndFunc ;==>_TraySetToolTip_Ex End of Edit ########################################################################### ; ; When I hoover over the tray icon, the current time is displayed, but not updated until I move the mouse away and back. ; Is there a magic command to refresh the traytooltip display during hoovering ? ; HotKeySet("{ESC}", "_ESC") Func _ESC() Exit EndFunc ;==>_ESC ; While Sleep(1000) TraySetToolTip(@HOUR& ":" & @MIN & ":"& @SEC) ; insert the magic command here. WEnd Edited June 9, 2019 by Exit Set topic solved App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
somdcomputerguy Posted December 22, 2012 Share Posted December 22, 2012 I use code like this in a 'clock' script. This would probably work for you, of course you would have to incorporate the @SEC macro, and you would replace the line where I use the GUICtrlSetData function with the TraySetToolTip function.Local $CurrentTime = @HOUR & @MIN While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit If $CurrentTime <> @HOUR & @MIN Then $CurrentTime = @HOUR & @MIN GUICtrlSetData($ClockLabel, TheTime()) EndIf Sleep(100) WEndSee how it works? The display only gets updated when needed. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Exit Posted December 23, 2012 Author Share Posted December 23, 2012 Thanks, but this does not help.. I want to update the display of a traytooltip when hoovering over the trayicon.The clockdisplay is only a sample to change the traytooltip every second.But the display of the traytooltip alters only if you move the mouse away from the trayicon and then back again.I am looking for a method to update the display of the traytooltip every second, even if the mouse remains on the trayicon. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
corgano Posted September 5, 2013 Share Posted September 5, 2013 This sir has a problem i now also possess. Anyone found a solution yet? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
j0kky Posted January 12, 2015 Share Posted January 12, 2015 Does anyone know a workaround? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
jdelaney Posted January 12, 2015 Share Posted January 12, 2015 (edited) a slightly diff approach: HotKeySet("{ESC}", "_ESC") Func _ESC() Exit EndFunc ;==>_ESC ; While Sleep(1000) TrayTip ( "", @HOUR& ":" & @MIN & ":"& @SEC,500 ) TraySetToolTip(@HOUR& ":" & @MIN & ":"& @SEC) ; insert the magic command here. WEnd Edited January 12, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
j0kky Posted January 12, 2015 Share Posted January 12, 2015 It's not what I'm searching for... I need to change the text of the tray icon box that appear while mouseover that, and to be able to update and show the refreshed text during mouseover! Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
j0kky Posted January 13, 2015 Share Posted January 13, 2015 Maybe I can try to operate on the icon through IUserNotification::SetIconInfo method... But how do I retrieve the handle of the standard Autoit icon? I don't think the handle returned by TrayItemGetHandle(0) is the right one Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
johnmcloud Posted January 13, 2015 Share Posted January 13, 2015 (edited) ; Johnmcloud - 2015 #include <Constants.au3> HotKeySet("{ESC}", "_Exit") TraySetToolTip("") While 1 Switch TrayGetMsg() Case $TRAY_EVENT_MOUSEOVER TrayTip("", @HOUR & ":" & @MIN & ":" & @SEC, 1) Case Else TrayTip("", "", 5) EndSwitch WEnd Func _Exit() Exit EndFunc ;==>_Exit Edited January 13, 2015 by johnmcloud Link to comment Share on other sites More sharing options...
j0kky Posted January 13, 2015 Share Posted January 13, 2015 (edited) I don't want the balloon notify, I need the square notify... And if you try to change your script in: Case $TRAY_EVENT_MOUSEOVER TraySetToolTip(@HOUR & ":" & @MIN & ":" & @SEC) It is not updated while mouseover it Edited January 13, 2015 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
johnmcloud Posted January 13, 2015 Share Posted January 13, 2015 (edited) Try this: expandcollapse popup#include <Constants.au3> HotKeySet("{ESC}", "_Exit") Global $aMPosOld[2], $fHover = False, $fTooltip = False _TraySetNoToolTip() While 1 $aMPosCurr = MouseGetPos() If $aMPosCurr[0] <> $aMPosOld[0] Or $aMPosCurr[1] <> $aMPosOld[1] Then $iMsg = TrayGetMsg() Switch $iMsg Case $TRAY_EVENT_MOUSEOVER $fHover = True Case Else $fHover = False EndSwitch $aMPosOld[0] = $aMPosCurr[0] $aMPosOld[1] = $aMPosCurr[1] EndIf If $fHover And Not $fTooltip Then $fTooltip = True AdlibRegister('_ToolTipEnable', 100) EndIf Sleep(10) WEnd Func _ToolTipEnable() Local Static $aMousePos = MouseGetPos() If $fHover Then ToolTip(@HOUR & ":" & @MIN & ":" & @SEC, $aMousePos[0], $aMousePos[1] - 30) If Not $fHover Then ToolTip("") EndFunc ;==>_ToolTipEnable Func _TraySetNoToolTip() Return TraySetToolTip(Chr(0)) EndFunc Func _Exit() Exit EndFunc ;==>_Exit In theory need to "disable" the default tooltip of the tray but require some knowledge i don't have, like DllStructSetData + Shell_NotifyIconW Was so easy to remove the default tooltip, i have update the script. An alternative without AdlibRegister and Static Y expandcollapse popup#include <Constants.au3> HotKeySet("{ESC}", "_Exit") Global $aMPosOld[2], $fHover = False, $fTooltip = False _TraySetNoToolTip() While 1 $aMPosCurr = MouseGetPos() If $aMPosCurr[0] <> $aMPosOld[0] Or $aMPosCurr[1] <> $aMPosOld[1] Then $iMsg = TrayGetMsg() Switch $iMsg Case $TRAY_EVENT_MOUSEOVER $fHover = True Case Else $fHover = False EndSwitch $aMPosOld[0] = $aMPosCurr[0] $aMPosOld[1] = $aMPosCurr[1] EndIf If $fHover Then $fTooltip = True _SetToolTip() ElseIf Not $fHover And $fTooltip Then $fTooltip = False ToolTip("") EndIf Sleep(10) WEnd Func _SetToolTip() Local Static $aXMousePos = MouseGetPos(0) Local $aYMousePos = MouseGetPos(1) ToolTip(@HOUR & ":" & @MIN & ":" & @SEC, $aXMousePos, $aYMousePos - 30) EndFunc Func _TraySetNoToolTip() Return TraySetToolTip(Chr(0)) EndFunc Func _Exit() Exit EndFunc ;==>_Exit Edited January 15, 2015 by johnmcloud Link to comment Share on other sites More sharing options...
jdelaney Posted January 14, 2015 Share Posted January 14, 2015 Here you go..._GUIToolTip_Update #include <GuiToolTip.au3> $sPrevious = @HOUR& ":" & @MIN & ":"& @SEC TraySetToolTip($sPrevious) While True $a = WinList("[CLASS:tooltips_class32]") For $i = 1 To UBound($a)-1 If WinGetTitle($a[$i][1]) = $sPrevious Then $sNew = @HOUR& ":" & @MIN & ":"& @SEC If $sNew <> $sPrevious Then ConsoleWrite(WinGetTitle($a[$i][1]) & @CRLF) TraySetToolTip($sNew) WinSetTitle($a[$i][1],"",$sNew) ControlSetText($a[$i][1],"","",$sNew) _GUIToolTip_Update($a[$i][1]) $sPrevious = $sNew EndIf EndIf Next Sleep(10) WEnd KaFu and j0kky 2 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
j0kky Posted January 14, 2015 Share Posted January 14, 2015 (edited) @JohmCloud: Your solution is really ingenious! But it has two problems: - As you've told, we need to disable the default icon description in some way: - When, by default, the icon is moved to notification area overflow, here it is what happens to your tooltip (I don't know why): In my opinion the only way to solve this problem is to proceed as Windows wants: through MSDN APICOM. But to do that I need to know the handle of the default Autoit taskbar icon... I think I'll open a separate thread to talk about this. @Jdelaney: you're a genius! It works really well I didn't know the existence of that UDF EDIT2: Excuse me, Jdelaney, but where do you documented about tooltips_class32 ? In MSDN library there is just a little hint about it in Automation Appendix Edited January 14, 2015 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
KaFu Posted January 15, 2015 Share Posted January 15, 2015 (edited) v2 expandcollapse popup#include <GuiToolbar.au3> #include <WinApi.au3> HotKeySet("{ESC}", "_Exit") Global $_SysTray_hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Global $_SysTray_hTrayNotifyWnd = ControlGetHandle($_SysTray_hTrayWnd, "", "[CLASS:TrayNotifyWnd]") Global $_SysTray_hSysPager = ControlGetHandle($_SysTray_hTrayNotifyWnd, "", "[CLASS:SysPager]") Global $_SysTray_hToolbar = ControlGetHandle($_SysTray_hSysPager, "", "[CLASS:ToolbarWindow32; INSTANCE:1]") ; User Promoted Notification Area/Notification Area/SysTray Global $_SysTray_hToolTip = _GUICtrlToolbar_GetToolTips($_SysTray_hToolbar) TraySetToolTip("Test " & TimerInit() & 11111111111111111111) AdlibRegister("_Update_Tooltip", 100) While 1 Sleep(10) WEnd Func _Update_Tooltip() If BitAND(WinGetState($_SysTray_hToolTip), 2) Then ; if tooltip is visible ; To test variable string length Local $s_String = "Test " & TimerInit() & " " For $i = 0 To Random(10, 99) $s_String &= 1 Next TraySetToolTip($s_String) ; Updates displayed string, but does not resize tooltip if string is too small or large... ; Tooltip remains of the size necessary to display the initial string _WinAPI_RedrawWindow($_SysTray_hToolTip) EndIf EndFunc ;==>_Update_Tooltip Func _Exit() Exit EndFunc ;==>_Exit Edited January 15, 2015 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Solution KaFu Posted January 16, 2015 Solution Share Posted January 16, 2015 Slightly optimized v3 taking jdelaneys code into account ... Func _TraySetToolTip_Ex($sText) If Not $sText Then $sText = Chr(0) ; Chr(0) = no tooltip displayed TraySetToolTip($sText) Local $_SysTray_hToolTip = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", ControlGetHandle(ControlGetHandle(ControlGetHandle(WinGetHandle("[CLASS:Shell_TrayWnd]"), "", "[CLASS:TrayNotifyWnd]"), "", "[CLASS:SysPager]"), "", "[CLASS:ToolbarWindow32; INSTANCE:1]"), "uint", 0x423, "wparam", 0, "lparam", 0) ; $TB_GETTOOLTIPS = 0x423 $_SysTray_hToolTip = HWnd($_SysTray_hToolTip[0]) if not IsHWnd($_SysTray_hToolTip) or WinGetTitle($_SysTray_hToolTip) <> $sText Then Return DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $_SysTray_hToolTip, "uint", 0x41D, "wparam", 0, "lparam", 0) ; $TTM_UPDATE = 0x41D EndFunc ;==>_TraySetToolTip_Ex Exit, j0kky and jdelaney 3 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
j0kky Posted January 16, 2015 Share Posted January 16, 2015 This is my version with Jdelaney & KaFu experiences joined: Func _TraySetToolTip_Ex($sText) If $sText == "" Then $sText = Null ;Null = "" and Not (Null == ""), this is useful for WinGetTitle TraySetToolTip($sText) Local $tt_array = WinList("[CLASS:tooltips_class32]") For $i = 1 To $tt_array[0][0] If WinGetTitle($tt_array[$i][1]) == $sText Then DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $tt_array[$i][1], "uint", 0x41D, "wparam", 0, "lparam", 0) Next EndFunc But I'm not completely satisfied... We're working only with tooltips... What about Tray icon handle? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
KaFu Posted January 16, 2015 Share Posted January 16, 2015 What about try icon handle? It seems as there is only one tooltip in the tray, which is re-used for the icon you're hovering over. If you want to obtain icon handles, take a look at HMW in my signature. I tested to manipulate the text in the tray icon structure itself, but that did not update the tooltip, in fact it only seemed like the hard way for TraySetToolTip() . OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
j0kky Posted January 16, 2015 Share Posted January 16, 2015 Did you use _Systray UDF by Wraithdu to retrieve notification area icon handle? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
KaFu Posted January 17, 2015 Share Posted January 17, 2015 HMW is based on heavily modified versions of these two UDFs: _SysTray_GetIcon by rover 2k11 '?do=embed' frameborder='0' data-embedContent>> _SysTray by Tuape & wraithdu'?do=embed' frameborder='0' data-embedContent>> OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
j0kky Posted January 17, 2015 Share Posted January 17, 2015 I think SysTrayGetButtonInfo function from _SysTray can be the solution... But I really don't understand why it is necessary to play with shared memory of explorer.exe to retrieve the icon handle, while my Autoit executable conceals in its code the icon handle (since the interpreter added that code before building it). Why Autoit devs don't make that handle accessible via a Macro?! Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs 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