Hi,
When I exit from a program that runs in the tray,
the tray isn't refreshing itself untill I move over
the tray with the mouse.
How can I refresh the tray within the code ?
TIA
Eddie
Printable View
Hi,
When I exit from a program that runs in the tray,
the tray isn't refreshing itself untill I move over
the tray with the mouse.
How can I refresh the tray within the code ?
TIA
Eddie
Hi Eddi
I don't know the variables you're using, but in my systemtray program, I'm using the following code when the form unloads:
I didn't try if 'Call Shell_NotifyIcon(NIM_DELETE, yourtrayicon)' is enough or if you really need all the code(I copied it, too)...Code:Sub Form_Unload(Cancel as Integer) 'your unload sub
'...your stuff
TrayIcon.cbSize = Len(TrayIcon)
TrayIcon.hwnd = Me.hwnd
TrayIcon.uId = vbNull
Call Shell_NotifyIcon(NIM_DELETE, TrayIcon)
Unload Me
End
End Sub
Hope you can use this
...and here's the code I'm using in my module...
Code:'----- Systray
Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONUP = &H205
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIF_MESSAGE = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public 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
Public TrayIcon As NOTIFYICONDATA