Mira yo uso este code:
en un modulo:
Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean 'declaracion para el shell icon
Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hWnd As Long) As Long
Public Resultado As String
Public Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * 128
dwState As Long
dwStateMask As Long
szInfo As String * 256
uTimeout As Long
szInfoTitle As String * 64
dwInfoFlags As Long
End Type
Public nf_IconData As NOTIFYICONDATA
'declaracion de constantes y de la api para crar un sysicon
Public Const NOTIFYICON_VERSION = 3
Public Const NOTIFYICON_OLDVERSION = 0
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIM_SETFOCUS = &H3
Public Const NIM_SETVERSION = &H4
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const NIF_STATE = &H8
Public Const NIF_INFO = &H10
Public Const NIS_HIDDEN = &H1
Public Const NIS_SHAREDICON = &H2
Public Const NIIF_NONE = &H0
Public Const NIIF_WARNING = &H2
Public Const NIIF_ERROR = &H3
Public Const NIIF_INFO = &H1
Public Const NIIF_GUID = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public Const WM_RBUTTONDBLCLK = &H206
en un form:(Form_Load)
With nf_IconData
.cbSize = Len(nf_IconData)
.hWnd = Me.hWnd
.uID = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = "Mi programa" & vbNullChar 'aquí se puede colocar lo que quiera que se vea al poner el cursor sobre el ícono
End With
Shell_NotifyIcon NIM_ADD, nf_IconData
y por ultimo el Form_MouseMove:
Select Case Msg
Case WM_LBUTTONUP 'restaura la ventana de formulario
Me.WindowState = vbNormal
Result = SetForegroundWindow(Me.hWnd)
Me.Show
Case WM_LBUTTONDBLCLK 'restaura la ventana de formulario
Me.WindowState = vbNormal
Result = SetForegroundWindow(Me.hWnd)
Me.Show
Case WM_RBUTTONUP 'desplega menú emergente
Result = SetForegroundWindow(Me.hWnd)
Me.PopupMenu Me.mnuMain 'mostrar el menu en el systray
End Select
en este punot teexplicacre como funciona.
cuando das doble click, o un solo click el restaura el form. si kieres un menu cuando des click derecho debes colocarlo en la funcion
WM_RBUTTONUP y listo.
bueno espero que te haya sido de ayuda este code.