Jump to content
Sign in to follow this  
Fossil Rock

Detecting a flashing window

Recommended Posts

Anyone know how to detect a flashing window. WinActive doesn't detect it. Also, is there a way to detect flashing taskbar button? I've thought of using pixelchecksum, but I'd have to do a lot of scanning to find it.

I found this code snippet if anyone can figure it out.

Public Const WH_SHELL = 10
Public Const HSHELL_REDRAW = 6

Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long

Public hHook As Long

Public Function ShellProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
ShellProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
'check for flashing windows
If wParam = HSHELL_REDRAW And lParam <> 0 Then
Debug.Print idHook & " is flashing."
' idHook should be the hWnd of the the flashing window.
End If
'call the next hook
ShellProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function

Public Sub StartHook()

'dig our grubby little hooks in...
hHook = SetWindowsHookEx(WH_SHELL, AddressOf ShellProc, App.hInstance, &H0)

End Sub
Public Sub StopHook()
'remove the windows-hook
'MAKE SURE you do this before your program exits, or it WILL crash your system.

UnhookWindowsHookEx hHook

End Sub
Edited by Fossil Rock

Agreement is not necessary - thinking for one's self is!



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...