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 WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim tk As NOTIFYICONDATA
Public Sub trayicon(kontrol As Boolean)
tk.cbSize = Len(tk)
tk.hwnd = Form1.Picture1.hwnd
tk.uId = 1&
tk.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
tk.ucallbackMessage = WM_MOUSEMOVE
tk.hIcon = Form1.Picture1.Picture ‘ İkon resmi
tk.szTip = " Sarkıntı " & Chr$(0)
If kontrol = False Then Shell_NotifyIcon NIM_DELETE, tk
If kontrol = True Then Shell_NotifyIcon NIM_ADD, tk
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Hex(x) = "1E3C" Then
Me.PopupMenu MnPr ‘ İkon PopUp mönüsü
End If
End Sub
Private Sub Form_Load()
trayicon True ' SysTray’e ikon eklenir
End Sub
Private Sub Form_Unload(Cancel As Integer)
trayicon False ' SysTray’den ikon silinir
End Sub