by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 18th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Flash a window using FlashWindow API
API Declarations
Private Declare Function FlashWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal wActive As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dMilliseconds As Long)
Dim i As Integer
Dim handle As Long ' Handle for the active window
Dim rval As Long
handle = GetActiveWindow() 'Get the handle of active window
For i = 1 To 10 ' Flash five times
rval = FlashWindow(handle, 1) 'Flash the window
Sleep 500 ' Delay the execution for 1/2 minute
Next
rval = FlashWindow(handle, 0) ' Bring the window to normal position
End Sub