Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Tray icon does not disappear until I hover mouse over it

Status
Not open for further replies.

rdgerken

Technical User
Joined
Jul 8, 2002
Messages
108
I have an app that uses a system tray icon. When the program ends, the icon is still visible, even though I remove the icon in the code. It will stay there until I hover my mouse over it, in which it will then disappear. Is there a way to "refresh" the system tray or something so that the icon disappears when the program ends?

Thanks
 
Before ending the app use this code to remove the icon. Where nid is the same type used for the add icon

Shell_NotifyIcon &H2, nid
DoEvents


 
I appreciate the help, but even after adding the "DoEvents" (I had the Shell_NotifyIcon line in there already), it still does not actually remove the icon from the system tray until I hover over it with my mouse. It seems to be a windows refresh problem. (I'm using windows xp)

Anyone else have this problem or an idea?

:)
 
i have this problem very often on a 2k pro machine! its not just VB apps it seems to be all kind of "professional" apps too.

i imagine its a windows problem rather than a coding problem!

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
The Great Date Debate Thread222-368305
File Formats Galore @ or
 
Hi All

I have used "Shell_NotifyIconA" to remove the icon from System Tray. It works perfectly.
Pleas try with this.

************************************************
Private Declare Function Shell_NotifyIconA Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Integer

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

************************************************

Regards
Som


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top