找找你的VB的安装盘。
里面有一个SysTray控件(是代码),就是用来干那事儿的。

解决方案 »

  1.   

    这里有个例子:Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As LongConst NIF_ICON = &H2
    Const NIF_MESSAGE = &H1
    Const NIF_TIP = &H4
    Const NIM_ADD = &H0
    Const NIM_DELETE = &H2
    Const WM_MOUSEMOVE = &H200
    Const WM_LBUTTONDOWN = &H201Private 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
    Dim TrayData As NOTIFYICONDATAPrivate Sub Form_Load()    With TrayData
            .cbSize = Len(TrayData)
            .hwnd = Me.hwnd
            .uID = 100&
            .uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
            .uCallbackMessage = WM_MOUSEMOVE
            .hIcon = imgTray.Picture   '图标
            .szTip = "提示信息"
        End With    If Shell_NotifyIcon(NIM_ADD, TrayData) = 0 Then
            MsgBox "不能加入图标!"
            End
        End If
        Me.Hide
        
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    Static bBusy As Boolean
        If bBusy = True Then
            Exit Sub
        End If
        
        bBusy = True    If Button = 1 Then
            PopupMenu mnuMenu
        End If
        
        bBusy = False
        
    End SubPrivate Sub Form_Unload(Cancel As Integer)    If Shell_NotifyIcon(NIM_DELETE, TrayData) = 0 Then
            MsgBox "不能删除图标!"
            Exit Sub
        End If
        
    End Sub