Use this:
VB Code:
Private WithEvents TI As cTrayIcon Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu Then 'I don't want to terminate the app Set TI = New cTrayIcon With TI .SetPct pctTray .CreateIcon "This is my app" End With Me.Hide Cancel = 1 End If End Sub Private Sub TI_TrayIconDoubleCLick() TI.DeleteIcon Set TI = Nothing Me.Show End Sub Private Sub Form_Unload(Cancel As Integer) TI.DeleteIcon Set TI = Nothing End Sub
pctTray is a picturebox (invisible) with the icon you want to show in the Systray.




image).
Reply With Quote