Bilgus Posted June 22, 2016 Share Posted June 22, 2016 (edited) You did try what nickston proposed correct? _TrayIconSetToolTip($nTrayIcon1, "Datornamn: " & @ComputerName & @CRLF & "IPAdress: " & @IPAddress1 & " ," & @IPAddress2 & @CRLF & "Gateway: " & "127.000.000.001") I'd say also try one at a time the same thing with @computername, @IpAddress1, @IpAddress2 I assume the Ip addresses are IPv4 and not IPv6 aswell all else fails try setting a loop sending strings and up the length till it breaks I don't have windows 10 I assume that is what you are using on both of these devices When you say you set the laptop to 63 do you mean the buffer size or StringLeft($sToolTip,63)? Edited June 22, 2016 by Bilgus Link to comment Share on other sites More sharing options...
lgvlgv Posted June 23, 2016 Share Posted June 23, 2016 im going to set a fixed length and run it for a while with Global $sNOTIFYICONDATAW = "dword;" & _ ; Struct size "hwnd;" & _ ; Callback window handle "uint;" & _ ; Icon ID "uint;" & _ ; Flags "uint;" & _ ; Callback message ID "hwnd;" & _ ; Icon handle "WCHAR[64];" & _ ; ToolTip text "dword;" & _ ; Icon state "dword;" & _ ; Icon state mask "WCHAR[256];" & _ ; Balloon ToolTip text "uint;" & _ ; Timeout / Version -> NIM_SETVERSION values 0, 3, 4 "WCHAR[64];" & _ ; Balloon ToolTip title text "dword" ; Balloon ToolTip info flags if @OSVersion = "WIN_10" THEN $sNOTIFYICONDATAW &= ";BYTE[128];" & _ ; Guid "hwnd" ; Balloon ToolTip IconHandle and ;********************************************************************** ; _TrayIconSetToolTip($NotificationID, $sToolTip) ;********************************************************************** Func _TrayIconSetToolTip($nID = -1, $sToolTip = $sDefaultTT) If $nID = -1 Then $nID = $TRAYLASTID If $TRAYMSGWND = 0 Or $nID <= 0 Then Return 0 Local $stNID = DllStructCreate($sNOTIFYICONDATAW) DllStructSetData($stNID, 1, DllStructGetSize($stNID)) DllStructSetData($stNID, 2, $TRAYMSGWND) DllStructSetData($stNID, 3, $nID) DllStructSetData($stNID, 4, $NIF_TIP) DllStructSetData($stNID, 7, StringLeft($sToolTip,127)) ; DllStructSetData($stNID, 7, $sToolTip) Return Shell_NotifyIcon($NIM_MODIFY, DllStructGetPtr($stNID)) EndFunc Main loop expandcollapse popupIf $LatencyTest = 1 Then If TimerDiff($iBegin) > $InternetCheckTime Then ; Loop until 5 sec have passed Local $gate = _GetGatewayIP() _DebugOut("GATE: " & $gate) Local $iPing = Ping($LatencyUrl, $LatencyMS) If @error Then If @error = 1 Then _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -5) Local $tool = StringLen(@ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Host is offline.") _DebugOut("Error1: " & $tool) ; _TrayIconSetToolTip($nTrayIcon1, @ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Host is offline.") _TrayIconSetToolTip($nTrayIcon1, "blablabla" & @CRLF & "IP: 127.000.000.001" & @CRLF & "Gate: bla.bla.bla.bla" & @CRLF & " error: (1) ") _DebugOut("*PING: " & @error & ", Host is offline") ElseIf @error = 2 Then _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -5) Local $tool = StringLen(@ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Host is unreachable.") _DebugOut("Error2: " & $tool) ;_TrayIconSetToolTip($nTrayIcon1, @ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Host is unreachable.") _TrayIconSetToolTip($nTrayIcon1, "blablabla" & @CRLF & "IP: 127.000.000.001" & @CRLF & "Gate: bla.bla.bla.bla" & @CRLF & " error:(2) ") _DebugOut("*PING: " & @error & ", Host is unreachable") ElseIf @error = 3 Then _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -5) Local $tool = StringLen(@ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Bad destination") _DebugOut("Error3: " & $tool) ; _TrayIconSetToolTip($nTrayIcon1, @ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Bad destination") _TrayIconSetToolTip($nTrayIcon1, "blablabla" & @CRLF & "IP: 127.000.000.001" & @CRLF & "Gate: bla.bla.bla.bla" & @CRLF & " error: (3) ") _DebugOut("*PING: " & @error & ", Bad destination") ElseIf @error = 4 Then _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -5) Local $tool = StringLen(@ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Bad destination") _DebugOut("Error4: " & $tool) ; _TrayIconSetToolTip($nTrayIcon1, @ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & " error: " & @error & ", Other errors") _TrayIconSetToolTip($nTrayIcon1, "blablabla" & @CRLF & "IP: 127.000.000.001" & @CRLF & "Gate: bla.bla.bla.bla" & @CRLF & " error: (4) ") _DebugOut("*PING: " & @error & ", Other errors") EndIf Else _DebugOut("*PING: The roundtrip-time took: " & $iPing & "ms.") If $iPing > "200" Then _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -6) Else _TrayIconSetIcon($nTrayIcon1, @ScriptFullPath, -1) EndIf Local $tool = StringLen(@ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & "Internet: " & $iPing & " Ms.") _DebugOut("Good: " & $tool) ; _TrayIconSetToolTip($nTrayIcon1, @ComputerName & @CRLF & "IP: " & @IPAddress1 & @CRLF & "Gate: " & $gate & @CRLF & "Internet: " & $iPing & " Ms.") _TrayIconSetToolTip($nTrayIcon1, "blablabla" & @CRLF & "IP: 127.000.000.001" & @CRLF & "Gate: bla.bla.bla.bla" & @CRLF & " error: (0) ") EndIf $iBegin = TimerInit() EndIf . Link to comment Share on other sites More sharing options...
lgvlgv Posted June 23, 2016 Share Posted June 23, 2016 (edited) hm, the abow Always cut the tip to blablabla IP: 127.000.000.001 Gate: bla.bla.bla.bla error:( So its missing "?) " Edited June 23, 2016 by lgvlgv Link to comment Share on other sites More sharing options...
lgvlgv Posted June 23, 2016 Share Posted June 23, 2016 also my machine at work, a virtuell windows 8.1 have been running the script over 24 hours without any problems. Link to comment Share on other sites More sharing options...
lgvlgv Posted June 23, 2016 Share Posted June 23, 2016 (edited) Update: did a test of when it hangs. after the 425 time of updateing the toolicontip it stopped. the check was set to update the tip every 6 sec, no more no less.. so it must be the way it updates not the string length in it self. so for 425 times it updated the tip correct, then start to run wild in cpu 20% utilisation and not responding to input other then that the Icon menu is availeble, but u cant click anything. Checked 2 times now the magic number is 425 times done every 6 sec Edited June 23, 2016 by lgvlgv Link to comment Share on other sites More sharing options...
lgvlgv Posted June 24, 2016 Share Posted June 24, 2016 Sorry, but u guys where right all along it was the _gateway function that coused problem. I was sure i removed it everywhere when i did the test on a fixed string, but i found it else where in the script.. problem is solved, thx for all ur help and that u took time to help me. Link to comment Share on other sites More sharing options...
Jara_Jara Posted December 25, 2017 Share Posted December 25, 2017 Hi guys, After searching a lot for solutions to have my very own system tray for Windows 10, with a Dark Theme look, I tried this UDF, and by the way it is fantastic. I tried to use it to simulate a "dark look", setting all the colors variables to a dark pattern, but the systray menus always have a gray/light border padding around the menu (and also a little bevel). I don't want to design my own systray menu system, and since I was so close to accomplish that with this UDF, could someone point me to the part of code that adds/puts this light padding around the systray menu, so I can reprogram it? giving it a flat design and really gaining the Dark Theme Windows 10 has? Thanks in advance! And Cheers from Brazil Link to comment Share on other sites More sharing options...
rumple Posted February 23, 2018 Share Posted February 23, 2018 Top job Holder, trying this in a project and looks good. Found an interesting issue when used and you set the background colour of a button on a gui though; ...even without using any of the functions and by just including ModernMenu.au3 a coloured button is blanked. It is still there and functions but not visible. Example: (un-comment the include to see issue) #include <GUIConstantsEx.au3> #include <ColorConstants.au3> ;#include <ModernMenu.au3> Example() Func Example() Local $hGUI = GUICreate("Example", 300, 200) Local $idHello = GUICtrlCreateButton("Hello", 120, 170, 85, 25) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetBkColor($idHello, $COLOR_SKYBLUE) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idHello MsgBox(0, "Still Here", "Hi there") EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Any suggestions ? Link to comment Share on other sites More sharing options...
LarsJ Posted February 24, 2018 Share Posted February 24, 2018 The issue is fixed in the updates in post 289. abberration 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
LarsJ Posted November 13, 2021 Share Posted November 13, 2021 A new small update in post 289. argumentum 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Parsix Posted August 15, 2023 Share Posted August 15, 2023 hi, how to change background color of a item? Link to comment Share on other sites More sharing options...
Parsix Posted September 5, 2023 Share Posted September 5, 2023 error when compile with Au3Stripper #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 6 -w 7 #Au3Stripper_Parameters=/sf #Au3Stripper_Ignore_Funcs=_traynotifyicon #Au3Stripper_Ignore_Errors_in_Funcs=_traynotifyicon,GUICtrlSetOnEvent,Call,DllCallbackRegister >Running Au3Stripper (23.402.1150.1) from:C:\Program Files (x86)\AutoIt3\SciTE\Au3Stripper cmdline: -### StripOnly/StripFunc Error: Found Call() statement using unsolvable Func, which will/could lead to removal of Funcs that are used by this Function. >### current Func: _traynotifyicon r:\libs-ext\modernmenuraw.au3(571,1): Warning for line:Call($TRAYNOTIFYIDS[$nID][5], $nID, $lParam) Link to comment Share on other sites More sharing options...
Parsix Posted September 7, 2023 Share Posted September 7, 2023 22 hours ago, moonlol said: This can happen if you are using a function from a third-party library or if you misspelled the function name. This error occurs in ModernMenuRaw.au3 (original file) Link to comment Share on other sites More sharing options...
hudsonhock Posted yesterday at 01:23 PM Share Posted yesterday at 01:23 PM (edited) Hi all, Thank you Holger's hard work on developed this UDF and all other developers' effort on updating so it can keep up with the latest Autoit version. I like the custom tray very much and appreciate the beauty how it can be customize. Now to the business, this is my main code with main tray menu which I am using OnEventMode expandcollapse popup#include "ModernMenuRaw.au3" #include "GuiLoopChkbox.au3" #include "OnEventChkbox.au3" #NoTrayIcon Opt("GUIOnEventMode", 1) ; Enable advanced menu and BGR colors $bUseAdvTrayMenu = TRUE $bUseRGBColors = FALSE _SetTrayBkColor(0xFFFFFF) ; White background _SetTrayIconBkColor(0xD2BDB6) ; Light orange/brown start _SetTrayIconBkGrdColor(0xD2BDB6) ; Darker orange/brown end _SetTraySelectBkColor(0xD2BDB6) ; Light selection color _SetTraySelectRectColor(0xD2BDB6) ; Dark selection border _SetTraySelectTextColor(0x000000) ; Black text on selection _SetTrayTextColor(0x000000) ; Black text ; Create main tray icon Local $nTrayIcon = _TrayIconCreate("Side Menu", "shell32.dll", -13, "TrayIconCallback") _TrayIconSetClick(-1, BitOR(1, 2, 4, 8, 16, 32)) _TrayIconSetState() ; Create main context menu Local $nTrayMenu = _TrayCreateContextMenu() ; Set the side menu to match Local $nSideMenu = _CreateSideMenu($nTrayMenu) _SetSideMenuText($nSideMenu, "Side Menu") _SetSideMenuColor($nSideMenu, 0xFFFFFF) _SetSideMenuBkColor($nSideMenu, 0x2244EE) _SetSideMenuBkGradColor($nSideMenu, 0x0066FF) ; Create Sub menu Local $nSubMenu = _TrayCreateMenu("Sub Menu") _TrayItemSetIcon(-1, "shell32.dll", -147) _TrayCreateItem("") _TrayItemSetIcon(-1, "", 0) ; Add sub item with separators Local $nItem1 = _TrayCreateItem("Item 1", $nSubMenu) _TrayItemSetIcon($nItem1, "shell32.dll", -147) _TrayCreateItem("", $nSubMenu) _TrayItemSetIcon(-1, "", 0) Local $nItem2 = _TrayCreateItem("Item 2", $nSubMenu) _TrayItemSetIcon($nItem2, "shell32.dll", -238) Local $nConfig = _TrayCreateItem("Configuration") _TrayItemSetIcon($nConfig, "shell32.dll", -317) GUICtrlSetOnEvent(-1, "OnConfig") _TrayCreateItem("") _TrayItemSetIcon(-1, "", 0) Local $nAbout = _TrayCreateItem("About") _TrayItemSetIcon($nAbout, "shell32.dll", -24) _TrayCreateItem("") _TrayItemSetIcon(-1, "", 0) Local $nExit = _TrayCreateItem("Exit") _TrayItemSetIcon($nExit, "shell32.dll", -28) GUICtrlSetOnEvent(-1, "OnExit") While 1 Sleep(100) WEnd ;==================================================================================================== Func OnExit() _TrayIconDelete($nTrayIcon) Exit EndFunc ;==================================================================================================== Func OnConfig() OnEvent_Chkbox() EndFunc By clicking the "Configuration" tray menu, it pop ups a config GUI which is a #include-once, also use OnEventMode. The "OnEventChkbox.au3" code as below: expandcollapse popup#include-once #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) Func OnEvent_Chkbox() Global $g_bExitFlag = False Global $g_hGUI = GUICreate("Example", 300, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") Global $g_idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) GUICtrlSetOnEvent($g_idCheckbox, "_StandardCheckbox") Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetOnEvent($idButton_Close, "_Close") ; Display the GUI. GUISetState(@SW_SHOW, $g_hGUI) While Not $g_bExitFlag Sleep(10) ConsoleWrite($g_bExitFlag & @CRLF) WEnd EndFunc ;==>OnEvent_Chkbox ;==================================================================================================== Func _StandardCheckbox() If BitAND(GUICtrlRead($g_idCheckbox), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox($MB_SYSTEMMODAL, "", "The checkbox is checked.", 0, $g_hGUI) Else MsgBox($MB_SYSTEMMODAL, "", "The checkbox is not checked.", 0, $g_hGUI) EndIf EndFunc ;==>_StandardCheckbox ;==================================================================================================== Func _Close() GUIDelete($g_hGUI) $g_bExitFlag = True EndFunc ;==>_Close The problem is that the config GUI doesn't respond to all control interactions, which I can't understand. But it works if I am using Message-loop Mode with same GUI and controls just different codes. The "GuiLoopChkbox.au3" code as below: #include-once #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Func ExampleCheckBox() Opt("GUIOnEventMode", 0) Local $g_hGUI = GUICreate("Example", 300, 200) Local $g_idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState(@SW_SHOW, $g_hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $g_idCheckbox If BitAND(GUICtrlRead($g_idCheckbox), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox($MB_SYSTEMMODAL, "", "The checkbox is checked.", 0, $g_hGUI) Else MsgBox($MB_SYSTEMMODAL, "", "The checkbox is not checked.", 0, $g_hGUI) EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($g_hGUI) Opt("GUIOnEventMode", 1) EndFunc ;==>ExampleCheckBox My question is: Am I missing something in my codes that I can't get both Tray and GUI in OnEvent Mode to works? If the Tray and GUI can't work together this way, will I bump into any problem if switch between OnEvent Mode & Message-loop Mode frequently? Edited yesterday at 01:30 PM by hudsonhock 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