Flash a window once using the FlashWindow API call.
Declare Auto Function FlashWindow Lib "User32" (ByVal hWnd As Int32, ByVal bInvert As Boolean) As Boolean
' True leaves the window in an inverse state.
' False flashes the window once and returns to normal.
Private Sub
WindowFlash()
FlashWindow(Me.Handle.ToInt32,
True)
End
Sub
Using the FlashWindowEx API call, you have more options.
Private
Structure FLASHWINFO
Dim cbSize
As Int32
'Size of the structure in
bytes
Dim
hwnd As
Int32 'Handle to the
window to be flashed
Dim
dwFlags As
Int32 'Flash Status
Dim
uCount As
Int32 'Number of times to
flash the window. Ignored if flashing continuously.
Dim
dwTimeout As
Int32 'Flash rate in
milliseconds. Zero=default system flash rate.
End
Structure
Const FLASHW_STOP
As Int32 = &H0
'Stop Flashing
Const
FLASHW_CAPTION As
Int32 = &H1 'Flash Window
Caption
Const
FLASHW_TRAY As
Int32 = &H2 'Flash
Tray Button
Const
FLASHW_ALL As
Int32 = &H3 'Same as
FLASHW_CAPTION + FLASHW_TRAY
Const
FLASHW_TIMER As
Int32 = &H4 'Flash
continuously until the FLASHW_STOP flag is set
Const
FLASHW_TIMERNOFG As
Int32 = &HC 'Flash
continuously until window comes to the foreground
Private
Declare
Auto
Function FlashWindowEx
Lib "User32" (ByRef
pfwi As
FLASHWINFO) As
Boolean
Private Sub
WindowFlash()
Dim FI
As FLASHWINFO
With FI
.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(FI)
.hwnd = Me.Handle.ToInt32
.dwFlags = FLASHW_ALL + FLASHW_TIMERNOFG
.uCount = 0
.dwTimeout = 0
End
With
FlashWindowEx(FI)
End Sub