Flash Window's Title Bar

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert 2 CommandButtons to your form (named Command1 and Command2)
'When you will press the first button the title bar will start to flash.
'To stop the flashing press on the second button
'Insert this code to the module :

Declare Function FlashWindow Lib "user32" _
(ByVal hwnd As Long, ByVal bInvert As Long) As Long

'Insert the following code to your form:

Dim blnDoorgaan As Boolean
Public Sub Flash(ByRef Form As Form, ByVal blnFlash As Boolean)
Dim sngStart As Single
If blnFlash Then
blnDoorgaan = True
blnDoorgaan = False
End If
Do While blnDoorgaan
FlashWindow Form.hwnd, True
sngStart = Timer
'Change the 0.5 number to increase\decrease the time between the flashes
Do While Timer < sngStart + 0.5
If Not blnDoorgaan Then FlashWindow Form.hwnd, False
End Sub

Private Sub Command1_Click()
Flash Form1, True
End Sub

Private Sub Command2_Click()
Flash Form1, False
End Sub

Go Back