Carlos Posted July 15, 2005 Share Posted July 15, 2005 I have running programs that show an trayicon. How can i hide thes icons? Link to comment Share on other sites More sharing options...
GaryFrost Posted July 15, 2005 Share Posted July 15, 2005 I have running programs that show an trayicon.How can i hide thes icons?<{POST_SNAPBACK}>Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
FuryCell Posted July 15, 2005 Share Posted July 15, 2005 (edited) Wouldn't #NoTrayIcon be better? Look at this qoute from the manual:You can use Opt("TrayIconHide", 1) to remove the AutoIt tray icon, but it will still be visible for a second when the script starts. Placing the #NoTrayIcon directive anywhere in your script will stop the icon from being shown at startup. Edited July 15, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
GaryFrost Posted July 15, 2005 Share Posted July 15, 2005 (edited) up to user Edited July 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
tuape Posted July 15, 2005 Share Posted July 15, 2005 (edited) I think he means hiding icon of "non-AutoIt" program. I did get this far: expandcollapse popupConst $TB_DELETEBUTTON = 1046 ;Const $TB_GETBUTTON = 1047 Const $TB_BUTTONCOUNT = 1048 ;Const $TB_GETBUTTONTEXT = 1099 _RemoveTrayButton() Func _GetToolBarButtonCount() Local $hWnd = _FindTrayToolbarWindow() Local $count = DLLCall("user32.dll","int","SendMessage", "hwnd", $hWnd[0], "int", $TB_BUTTONCOUNT, "int", 0, "int", 0) EndFunc Func _RemoveTrayButton($index=1) Local $hWnd = _FindTrayToolbarWindow() DLLCall("user32.dll","int","SendMessage", "hwnd", $hWnd[0], "int", $TB_DELETEBUTTON, "int", $index, "int", 0) If Not @error Then return 1 Else return -1 EndIf EndFunc ; Utility function Func _FindTrayToolbarWindow() Local $hWnd = DLLCall("user32.dll","hwnd","FindWindow", "str", "Shell_TrayWnd", "int", 0) if Not @error Then $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "TrayNotifyWnd", "int", 0) if Not @error Then $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "SysPager", "int", 0) if Not @error Then $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "ToolbarWindow32", "int", 0) EndIf EndIf EndIf Return $hWnd EndFunc _RemoveTrayButton removes traybutton which index is given as a parameter. Index 1 is first button from the left (including icons that are hided in XP).. So the above example will remove first button from the left. Somebody might want to study if we can identify buttons by other means (text etc.). I took a quick look but it seemed ugly (structures etc.) Edited July 15, 2005 by tuape Link to comment Share on other sites More sharing options...
t0ddie Posted July 16, 2005 Share Posted July 16, 2005 nice code. how would you put the icon BACK? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Carlos Posted July 16, 2005 Author Share Posted July 16, 2005 So the above example will remove first button from the left.Somebody might want to study if we can identify buttons by other means (text etc.). I took a quick look but it seemed ugly (structures etc.)<{POST_SNAPBACK}>Can we use this?http://www.codeguru.com/Cpp/COM-Tech/shell...icle.php/c1335/ Link to comment Share on other sites More sharing options...
tuape Posted July 17, 2005 Share Posted July 17, 2005 Can we use this?http://www.codeguru.com/Cpp/COM-Tech/shell...icle.php/c1335/<{POST_SNAPBACK}>Not really, no. I think that this will help you create and remove icon owned by your own program.However, I did find another reference. It seems that this is quite complicated process involving reading other process' memory.So far I have succeeded in getting names (=Window titles) of all programs that have icon at systray + removing icons completely from tray.I will post an UDF to another thread later today. I was thinking to include at least these functions:SysTrayIconCount() - Get count of all systray iconsSysTrayIconWinTitle($index) - Get wintitle of specific iconSysTrayIconAllTitles() - Get titles of all programs that have icon on systraySysTrayIconProcess($index) - Get process name linked to specific iconSysTrayIconPid($index) - Get parent process id of specific iconSysTrayIconRemove($index) - Remove icon (removes completely, not just hide)SysTrayIconIndex($wintitle or $process)@t0ddie: The above removes icons completely (meaning you have to stop & restart the process owning icon / restart pc to get them back). After I get the first version of this SysTray UDF ready I will take a look of hiding / unhiding icons. Link to comment Share on other sites More sharing options...
tuape Posted July 19, 2005 Share Posted July 19, 2005 I did put the UDF here few days ago: SysTray UDFI changed function names & functionality a bit. Try it out and give comments or suggestion what could/should be added. 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