#Include once "window9.bi"

Dim shared note as NOTIFYICONDATA

Function AddSysTrayIcon(ByVal NumberSysTray As Integer,ByVal hwnd As HWND,ByVal icon As HICON,ByVal ToolTipSysTray As String) As Integer export
	note.cbSize = sizeof(NOTIFYICONDATA)
	note.hwnd = hWnd
	note.uID = NumberSysTray
	note.uFlags = NIF_ICON+NIF_MESSAGE+NIF_TIP
	note.uCallbackMessage = 1029
	note.hIcon = icon
	note.szTip= ToolTipSysTray
	Return Shell_NotifyIcon (NIM_ADD,@note)
End Function

Function ReplaceSysTrayIcon(ByVal NumberSysTray As Integer,ByVal icon As HICON,ByVal ToolTipSysTray As String) As Integer export
	note.cbSize = sizeof(NOTIFYICONDATA)
	note.uID = NumberSysTray
	note.uFlags = NIF_ICON+NIF_MESSAGE+NIF_TIP
	note.uCallbackMessage = 1029
	note.hIcon = icon
	note.szTip= ToolTipSysTray
	Return Shell_NotifyIcon (NIM_MODIFY,@note)
End Function

Function DeleteSysTrayIcon(ByVal NumberSysTray As Integer) As Integer export
	note.cbSize = sizeof(NOTIFYICONDATA)
	note.uID = NumberSysTray
	Return Shell_NotifyIcon (NIM_DELETE,@note)
End Function

Function MessageSysTrayIcon(ByVal NumberSysTray As Integer,ByVal hwnd As HWND,Title As String,Text As String,Timeout As Integer = 5000,ByVal icon As HICON = 0 , ByVal TypeIcon As Integer = NIIF_INFO) As Integer export
	note.cbSize = sizeof(NOTIFYICONDATA)
	note.hwnd = hWnd
	note.uID = NumberSysTray
	note.uFlags = IIf (icon<>0,NIF_INFO+NIF_ICON,NIF_INFO)
	note.hIcon = icon
	note.szInfo = Text
	note.uTimeout = Timeout
	note.szInfoTitle = Title
	note.dwInfoFlags = TypeIcon
	Return Shell_NotifyIcon (NIM_MODIFY,@note)
End Function


