Private Sub Command1_Click()
'Add an icon. This procedure uses the icon specified in
'the Icon property of Form1. This can be modified as desired.
Dim i As Integer
Dim s As String
Dim nid As NOTIFYICONDATA
s = InputBox("Enter string:")
nid = setNOTIFYICONDATA(hWnd:=Form1.hWnd, _
ID:=vbNull, _
Flags:=NIF_MESSAGE Or NIF_ICON _
Or NIF_TIP, _
CallbackMessage:=vbNull, _
Icon:=Form1.Icon, _
Tip:=s)
i = Shell_NotifyIconA(NIM_ADD, nid)
End Sub
Private Sub Command2_Click()
'Modify an existing icon. This procedure uses the icon
'specified in the Icon property of Form1.This can be modified
'as desired.
Dim i As Integer
Dim s As String
Dim nid As NOTIFYICONDATA
s = InputBox("Enter string:")
nid = setNOTIFYICONDATA(hWnd:=Form1.hWnd, _
ID:=vbNull, _
Flags:=NIF_MESSAGE Or NIF_ICON _
Or NIF_TIP, _
CallbackMessage:=vbNull, _
Icon:=Form1.Icon, _
Tip:=s)
i = Shell_NotifyIconA(NIM_MODIFY, nid)
End Sub
Private Sub Command3_Click()
'Delete an existing icon.
Dim i As Integer
Dim nid As NOTIFYICONDATA
nid = setNOTIFYICONDATA(hWnd:=Form1.hWnd, _
ID:=vbNull, _
Flags:=NIF_MESSAGE Or NIF_ICON _
Or NIF_TIP, _
CallbackMessage:=vbNull, _
Icon:=Form1.Icon, _
Tip:="")
i = Shell_NotifyIconA(NIM_DELETE, nid)
End Sub