CodeItBetter Programming Another VB Programming Blog

How to flash taskbar (Like MSN Messanger)

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'System & API - How to flash taskbar (Like MSN Messanger)
Private Const FLASHW_STOP = 0 'Stop flashing. The system restores the window to its original state.
Private Const FLASHW_CAPTION = &H1 'Flash the window caption.
Private Const FLASHW_TRAY = &H2 'Flash the taskbar button.
'Flash both the window caption and taskbar button. 
'This is equivalent to setting the FLASHW_CAPTION Or FLASHW_TRAY flags.
Private Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY) 
Private Const FLASHW_TIMER = &H4 'Flash continuously, until the FLASHW_STOP flag is set.
Private Const FLASHW_TIMERNOFG = &HC 'Flash continuously until the window comes to the foreground.

Private Type FLASHWINFO
    cbSize As Long
    hwnd As Long
    dwFlags As Long
    uCount As Long
    dwTimeout As Long
End Type
 
Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO) As Boolean
 
Private Sub Form_Resize()
    Dim FlashInfo As FLASHWINFO
    If Me.WindowState = vbMinimized Then
        With FlashInfo
            .cbSize = Len(FlashInfo)
            .dwFlags = FLASHW_ALL Or FLASHW_TIMER
            'Specifies the rate, in milliseconds, at which the window will be flashed.
            'If dwTimeout is zero, the function uses the default cursor blink rate.
            .dwTimeout = 0
            .hwnd = Me.hwnd
            .uCount = 0
        End With
        FlashWindowEx FlashInfo
    Else
        With FlashInfo
            .cbSize = Len(FlashInfo)
            .dwFlags = FLASHW_STOP
            .hwnd = Me.hwnd
        End With
        FlashWindowEx FlashInfo
    End If
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.