questo è il codice che utilizzo
per un'icone nella TRAY con menu al Click del Mouse.
codice:
Menu di della finestra
name = traymenu
Caption = "Tray menu"
name = traymenu_tray1
Caption = "This is an example"
name = traymenu_tray2
Caption = "of the tray control"
name = traymenu_dash1
Caption = "-"
name = traymenu_cooleh
Caption = "Cool Eh!"
name = traymenu_exit
Caption = "Exit Program"
Attribute VB_Name = "TrayEx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
' hide this form so that only the tray icon is visible
Me.Hide
' get te picture that will be used for the tray icon.
SavePicture Me.Icon, "temp.icx"
' Set the tray properties.
Tray1.SetPicture = "temp.icx"
Tray1.SetTip = "Tray Control Example"
' Then load it into the system Tray!
Tray1.Add
End Sub
Private Sub Form_Unload(Cancel As Integer)
' clean things up before we exit.
' delete the icon out of the tray.
Tray1.Delete
' delete the temp icon file
Kill "temp.icx"
End
End Sub
Private Sub Tray1_MouseClick(Button As Integer)
' we want to look for a right single click .. button = 4
If Button = 4 Then
PopupMenu traymenu
end if
End Sub
Private Sub traymenu_exit_Click()
' close program to menu
Unload Me
End Sub