Results 1 to 7 of 7

Thread: Other System Tray Icons Question!...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    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).
    Last edited by Slyke; Apr 30th, 2007 at 08:31 PM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: Other System Tray Icons Question!...

    Is someone going to help?


    Here's the code that i got so far:

    vb Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    3.  
    4. Private Type NOTIFYICONDATA
    5.     cbSize As Long
    6.     hWnd As Long
    7.     uId As Long
    8.     uFlags As Long
    9.     ucallbackMessage As Long
    10.     hIcon As Long
    11.     szTip As String * 64
    12. End Type
    13.  
    14. Private Const NIM_ADD = &H0
    15. Private Const NIM_MODIFY = &H1
    16. Private Const NIM_DELETE = &H2
    17. Private Const NIF_MESSAGE = &H1
    18. Private Const NIF_ICON = &H2
    19. Private Const NIF_TIP = &H4
    20.  
    21. Private Const WM_LBUTTONDBLCLK = &H203
    22. Private Const WM_LBUTTONDOWN = &H201
    23. Private Const WM_RBUTTONUP = &H205
    24.  
    25. Dim TrayI As NOTIFYICONDATA
    26.  
    27. Private Sub CmdFind_Click()
    28.  
    29. hWndTxt.Text = FindWindow(vbNullString, "Hamachi")
    30.  
    31. Shell_NotifyIcon NIM_ADD, TrayI
    32.  
    33. End Sub
    34.  
    35. Private Sub CmdHide_Click()
    36.  
    37.     TrayI.cbSize = Len(TrayI)
    38.     TrayI.hWnd = hWndTxt.Text
    39.     TrayI.uId = 1&
    40.     Shell_NotifyIcon NIM_DELETE, TrayI
    41.  
    42.  
    43. End Sub


    The problem is that the Icon keeps comming back now (for some reason). Is there some way to stop this?

  4. #4
    New Member
    Join Date
    May 2007
    Posts
    6

    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

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: Other System Tray Icons Question!...

    Yes, but the icon will appear up & then vanish (which is annoying & using system resources).

  6. #6
    Lively Member
    Join Date
    Jan 2007
    Posts
    96

    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?

  7. #7
    Fanatic Member ididntdoit's Avatar
    Join Date
    Apr 2006
    Location
    :uoıʇɐɔoן
    Posts
    765

    Talking 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.
    Visit here to learn to make the VB interface fit you!.
    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison
    "The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners" -- Ernst Jan Plugge

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width