fatto ...
ecco il codice per chi servisse..
codice:
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
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const WM_MBUTTONDBLCLK = &H209
Private Const WM_MBUTTONDOWN = &H207
Private Const WM_MBUTTONUP = &H208
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim TrayI As NOTIFYICONDATA
Private Sub Form_Load()
TrayI.cbSize = Len(TrayI)
TrayI.hWnd = pichook.hWnd 'Link the trayicon to this picturebox
TrayI.uId = 1&
TrayI.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
TrayI.ucallbackMessage = WM_LBUTTONDOWN
TrayI.hIcon = imgIcon(2).Picture
TrayI.szTip = "KPD-Team 1999" & Chr$(0)
'Create the icon
Shell_NotifyIcon NIM_ADD, TrayI
Me.Hide
End Sub
Private Sub Form_Unload(Cancel As Integer)
TrayI.cbSize = Len(TrayI)
TrayI.hWnd = pichook.hWnd
TrayI.uId = 1&
'Delete the icon
Shell_NotifyIcon NIM_DELETE, TrayI
End
End Sub
Private Sub mnuPop_Click(Index As Integer)
Select Case Index
Case 0 'About
MsgBox "KPD-Team 1999" + vbCrLf + "E-Mail: KPD_Team@Hotmail.com" + vbCrLf + "URL: http://users.turboline.be/btl10148/", vbInformation + vbOKOnly
Case 2 'End
Unload Me
End Select
End Sub
Private Sub pichook_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Msg = X / Screen.TwipsPerPixelX
If Msg = WM_LBUTTONDBLCLK Then 'If the user dubbel-clicked on the icon
mnuPop_Click 0
ElseIf Msg = WM_RBUTTONUP Then 'Right click
Me.PopupMenu mnuPopUp
End If
End Sub
Private Sub Timer1_Timer()
'Animate icon
Static mPic As Integer
Me.Icon = imgIcon(mPic).Picture
TrayI.hIcon = imgIcon(mPic).Picture
mPic = mPic + 1
If mPic = 3 Then mPic = 0
Shell_NotifyIcon NIM_MODIFY, TrayI
End Sub
ecco il link del progetto:
qui