只要动态改变托盘图标就可以了。
比如你用VB光盘里的SYSTRAY控件的话可以这样子Set cTray.TrayIcon=Image1.Picture可以用Timer控件来控制

解决方案 »

  1.   

    用timer隔一段時間換一個圖標.
      

  2.   

    1 像QQ一样,一有消息,系统托盘区一闪一闪的,如何做的?
    2 QQ窗体的收缩隐藏是如何做到
    都可用 Timer 控件.
      

  3.   

    很简单,系统托盘区一闪一闪的你可以看成是两个动作,即系统托盘区的图标是一只小企鹅,再变成系统托盘区的图标是整个都是灰色的(与系统托盘区的背景色相同)。实现方法:先在窗体上建一个ImageList控件,然后添加刚刚提到的两个图标,用Timer控制每秒两个交换一下就行了。
      

  4.   

    QQ窗体的收缩隐藏:
    timer控件捕捉 MouseExit 事件
    '声明
    Public Declare Function GetCursorPos Lib "user32" (lpPoint As _pointapi) As Long
    Type pointapi
    x As Long
    y As Long
    End Type
    '过程
    Private Sub Timer1_Timer()
    Dim a As Long
    a = GetCursorPos(mouse)
    If (mouse.x > frmMain.ScaleWidth) Or (mouse.y > _frmMain.ScaleHeight ) Then
    frmMain.Top = (0 - frmMain.Height) + 100
    End If
    If mouse.y < 30 Then 
    frmMain.Top = 10 '理论上为0End If
    End Sub
    注意:form1.scalemode设置为2
      

  5.   

    提个思路吧
    当MOUSE指向窗体时,它自动将高度height 变为正常的,当MOUSE离开窗体是再将
    高度height 变成一个很小的值,我想不能是0
      

  6.   

    我封装好的代码,绝对好用!
    而且支持停靠。
    注意:tmrMousePos的触发属性设置为1。反正能小就小,呵呵Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Dim MousePos As POINTAPI
    Const FLAT_TOP = 1
    Const FLAT_BOTTOM = 2
    Const FLAT_LEFT = 4
    Const FLAT_RIGHT = 8
    Dim FlatFlag As IntegerPublic Function PtInRect(r As RECT, pt As POINTAPI) As Boolean
    If r.Left <= pt.X And pt.X <= r.Right And r.Top <= pt.Y And pt.Y < r.Bottom Then PtInRect = True Else PtInRect = False
    End FunctionPublic Sub CursorPosTimer()
        Dim r As RECT
        Dim lRight As Long
        Dim ir As Boolean
        GetWindowRect Me.hwnd, r
        
        ir = PtInRect(r, MousePos)
        If (FlatFlag And FLAT_LEFT) = FLAT_LEFT Then
            If MousePos.X <= 2 And ir Then
                Me.Left = 0
                SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
            Else
                If Me.Left = 0 And Not ir Then
                    Me.Left = -Me.Width + 2 * Screen.TwipsPerPixelX
                    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
                End If
            End If
        End If
        lRight = Screen.Width / Screen.TwipsPerPixelX - Me.Width / Screen.TwipsPerPixelX
        If (FlatFlag And FLAT_RIGHT) = FLAT_RIGHT Then
            If MousePos.X >= lRight - 2 And ir Then
                Me.Left = lRight * Screen.TwipsPerPixelX
                SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
            Else
                If Me.Left = lRight * Screen.TwipsPerPixelX  And Not ir Then
                    Me.Left = Screen.Width - 2 * Screen.TwipsPerPixelX
                    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
                End If
            End If
        End If    If (FlatFlag And FLAT_TOP) = FLAT_TOP Then
            If MousePos.Y <= 2 And ir Then
                Me.Top = 0
                SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
            Else
                If Me.Top = 0 And Not ir Then
                    Me.Top = -Me.Height + 2 * Screen.TwipsPerPixelY
                    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
                End If
            End If
        End If
        
    End SubPrivate Sub tmrMousePos_Timer()
        GetCursorPos MousePos
        CursorPosTimer
    End Sub
      

  7.   

    用timer控件中的事件就可以了!随时改变ddd中的图标句柄然后
    shell_notifyicon(nim_modify,@ddd);
    行了,给分吧