

直接调用API函数 Shell_NotifyIcon实现 函数声明: 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 t As NOTIFYICONDATA '调用加减任务栏图标过程 sub sysIcon(bShow as boolean) if bshow then '显示图标 t.cbSize = Len(t) t.hwnd = .picSysIcon.hwnd t.uId = 1& t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE t.ucallbackMessage = WM_MOUSEMOVE t.hIcon = picSysIcon.Picture t.szTip = App.Title & Chr$(0) Shell_NotifyIcon NIM_ADD, t App.TaskVisible = False else t.cbSize = Len(t) t.hwnd = picSysIcon.hwnd t.uId = 1& Shell_NotifyIcon NIM_DELETE, t end if end