请问:
   运行vb程序后--最小化到任务栏(如qq一样),双击它的图标又能打开...

解决方案 »

  1.   

    托盘参考:
    '窗体放一个Command1,把窗体的ShowInTaskbar属性设置为False
    Option ExplicitPrivate Type NOTIFYICONDATA '托盘结构
        cbSize As Long
        hwnd As Long
        uID As Long
        uFlags As Long
        uCallbackMessage As Long
        hIcon As Long
        szTip As String * 128
        dwState As Long
        dwStateMask As Long
        szInfo As String * 256
        uTimeoutAndVersion As Long
        szInfoTitle As String * 64
        dwInfoFlags As Long
    End Type
    Const niif_info = &H1Private Const NIM_ADD = &H0
    Private Const NIM_MODIFY = &H1
    Private Const NIM_DELETE = &H2
    Private Const NIF_MESSAGE = &H1
    Private Const NIF_ICON = &H2
    Private Const NIF_TIP = &H4
    Private Const NIF_INFO = &H10
    Private Const WM_LBUTTONDBLCLK = &H203
    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_RBUTTONUP = &H205
    Private Const WM_MOUSEMOVE As Long = &H200Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean '托盘函数
    Dim TrayI As NOTIFYICONDATA
    Private Sub Command1_Click() '气泡提示(别忘了加一个command1控件)
        Dim infotitle
         infotitle = "题目"
        Dim info
          info = "内容"
        With TrayI
        .cbSize = Len(TrayI)
        .hwnd = Form1.hwnd
        .uID = vbNull
        .uFlags = NIF_INFO
        .dwInfoFlags = niif_info
        .szInfoTitle = infotitle & vbNullChar
        .szInfo = info & vbNullChar
        End With
        Shell_NotifyIcon NIM_MODIFY, TrayI
    End SubPrivate Sub Form_Load()
        Dim Title_tray As String
        Title_tray = "我爱你"
        With TrayI
           .cbSize = Len(TrayI)
           .hwnd = Form1.hwnd
           .uID = vbNull
           .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
           .uCallbackMessage = WM_MOUSEMOVE
           .hIcon = Form1.Icon
           .szTip = Title_tray & vbNullChar
        End With
            Call Shell_NotifyIcon(NIM_ADD, TrayI)
    End Sub
        
        Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
         If Button = 1 Then
           Me.WindowState = vbNormal
           Me.Visible = True
    '      Form1.PopupMenu Form1.bb
         End If
         If Button = 2 Then
         '右键
         End If
    End SubPrivate Sub Timer1_Timer()
     Dim a
     a = 1
    End SubPrivate Sub Form_Resize()
        If Me.WindowState = vbMinimized Then
           Me.Visible = False
        End If
    End Sub
      

  2.   

    我的网站上有此类问题的源码,你可以去看看。http://www.j2soft.cn/VB资料->查询“托盘程序”;=================
    学习技巧与源码下载站:
    http://www.j2soft.cn/
    http://j2soft.008.net/
      

  3.   

    在VB的安装盘里有例子,vb光盘中\TOOLS\UNSUPPRT\SYSTRAY