Re: Icons in systray problem
Hi Mark
How did you setup the icon with NOTIFIYICONDATA ?
This is the code I used in the VBCodeLibrary Example on the CodeGuru site :
Private Sub SetupSysTrayIcon()
'
' Setup the System Tray Icon
'
Dim tTrayStuff As NOTIFYICONDATA
With tTrayStuff
.cbSize = Len(tTrayStuff)
.hwnd = picSysBar.hwnd
.uId = 1& ' uid is a unique identifier for the systray icon
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = "VBCodeLibrary Tool" & vbNullChar
Shell_NotifyIcon NIM_ADD, tTrayStuff
End With
End Sub
Private Sub KillSysTrayIcon()
Dim t As NOTIFYICONDATA
'
' Kill the icon in the system tray
'
With t
.cbSize = Len(t)
.hwnd = picSysBar.hwnd
.uId = 1&
End With
Shell_NotifyIcon NIM_DELETE, t
End Sub
I call the SetupSysTrayIcon on Form_Load and the KillSysTrayIcon on Form_Unload.
Are you setting the '.uid' parameter to be the correct icon identifier ? I imagine this could be your problem.
By the way I'm just finishing a new project for the CodeGuru site that adds a shortcut to your favourite programs into the systray (using the correct icon) and can start an instance of that program with one click - it uses all the NOTIFYICONDATA structure throughout with subclassing to react to the clicked icon (interested ?)
Regards
Chris Eastwood
CodeGuru - the website for developers
http://www.codeguru.com/vb