by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 23rd January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
'Find a window knowing it's caption using FindWindow API
API Declarations
Private Declare Function FlashWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: [email protected]
Private Sub Form_Load()
Dim dwnd As Long
Dim rval As Long
Dim i As Integer
'Find a window having caption VBFinished
dwnd = FindWindow(vbNullString, "VBFinished")
If dwnd Then 'If Found
For i = 1 To 10 ' Flash the found window 5 times
rval = FlashWindow(dwnd, 1) 'Flash window
Sleep 300 'Delay
Next
rval = FlashWindow(dwnd, 0) 'Bring to normal
End If
End Sub