Other System Tray Icons Question!...
I was wondering if it were possible to remove the icons from Other programs in the system tray?
How would i go about this?
For example with Hamachi, it's a useful program and all that, but the icon does get annoying down there, especially if there's alot of other icons. Would it be possible to remove the icon so that you'd have to open it again to display Hamachi (This is why i want to make this application).
Re: Other System Tray Icons Question!...
I was thinking about this and would getting the hWnd of Hamachi & removing the icon as you would when you are removing your own program.
Would this possibly work? I cannot test this at the moment.
Also how would one get the hWnd of Hamachi (since it's hidden).
This is a general question, but the program is being made for Hamachi.
Re: Other System Tray Icons Question!...
Is someone going to help?
Here's the code that i got so far:
vb Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_RBUTTONUP = &H205
Dim TrayI As NOTIFYICONDATA
Private Sub CmdFind_Click()
hWndTxt.Text = FindWindow(vbNullString, "Hamachi")
Shell_NotifyIcon NIM_ADD, TrayI
End Sub
Private Sub CmdHide_Click()
TrayI.cbSize = Len(TrayI)
TrayI.hWnd = hWndTxt.Text
TrayI.uId = 1&
Shell_NotifyIcon NIM_DELETE, TrayI
End Sub
The problem is that the Icon keeps comming back now (for some reason). Is there some way to stop this?
Re: Other System Tray Icons Question!...
maybe a timer can do this. I mean if the Icon comes back every continually, the timer can execute the Sub you've written (for example) every 4 or 5 seconds
Re: Other System Tray Icons Question!...
Yes, but the icon will appear up & then vanish (which is annoying & using system resources).
Re: Other System Tray Icons Question!...
i was also trying to do something similar but instead of removing the system tray icons i was trying to restore the application by double clicking the icon. however, i can't find the window since it is hidden into the tray. also, i'm thinking ahead of myself but if i can manage to actually find the icon, what if i have 2 instances of it running?
can anyone shed some light on this?
Re: Other System Tray Icons Question!...
Tricky stuff. Maybe try subclassing the program and stopping all outgoing tray icon messages. Also, have you looked into all the option in the program? Most programs allow you to turn off the tray icon.
A non VB way - right click the task bar, then click properties. Check 'hide inactive icons' and under 'Customize...' find the icon you don't want and set it to be always hidden. :cool: