FlashBar




Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
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)
Private Sub Command1_Click()
'Flash Form1 five times to get the user's attention

Dim c As Integer, retval As Long ' counter variable & return value
'If the program cannot find the sound it will play the system default for you

retval = PlaySound("C:\windows\msremind.wav", 0, _
SND_FILENAME Or SND_ASYNC Or SND_NODEFAULT Or SND_LOOP)
For c = 1 To 10 ' flash on five times, off five times
'if you put the playsound function (2 lines above) in here

'it will make the sound very time the window flashes!

retval = FlashWindow(Form1.hwnd, 1) ' toggle the look of the window
Sleep 500 ' halt execution for 500 milliseconds (1/2 second)
Next c
retval = FlashWindow(Form1.hwnd, 0) ' make sure the window looks normal
End Sub

Private Sub Form_Unload(Cancel As Integer)
MsgBox "Make sure you vote for me on Planet Source Code!", _
vbCritical, "Good-Bye"
End Sub

Rendere lampeggiante la barra di un Form










( flashbar.html )- by Paolo Puglisi - Modifica del 17/12/2023