Attribute VB_Name = "ModuloIcono"
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Long
Public SystemTray As clsSystemTray

Dim TrayIconData As NOTIFYICONDATA

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



Sub AddIcon()
Set SystemTray = New clsSystemTray

SystemTray.Icon = Form12.Icon
Set SystemTray.PPictureBox = Form12.pikForSYSTRAY
SystemTray.ToolTipText = VERSION_NAME & "'s API Spy (Ver " & App.Major & "." & App.Minor & "." & App.Revision & ")"

SystemTray.AddIconToSystemTray
End Sub

Public Sub RemoveIconFromSystemTray()
    
    TrayIconData.cbSize = Len(TrayIconData)
    TrayIconData.hWnd = clsSystemTray.hWnd
    TrayIconData.uID = CLng(2)
    
    lRetValue = Shell_NotifyIcon(NIM_DELETE, TrayIconData)
End Sub
Private Sub SystemTray_LButtonDblClk()
If frmMain.Visible = True Then Exit Sub

frmMain.Visible = True
End Sub

Private Sub SystemTray_RButtonUp()
Form1.PopupMenu Form1.Menu1
End Sub

