Created
December 6, 2015 15:57
-
-
Save jploudre/1c90df432859f3cfa913 to your computer and use it in GitHub Desktop.
Shell hook for window open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Persistent | |
| SetBatchLines, -1 | |
| Process, Priority,, High | |
| Gui +LastFound | |
| hWnd := WinExist() | |
| DllCall( "RegisterShellHookWindow", UInt,hWnd ) | |
| MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" ) | |
| OnMessage( MsgNum, "ShellMessage" ) | |
| Return | |
| ShellMessage( wParam,lParam ) | |
| { | |
| If ( wParam = 1 ) ; HSHELL_WINDOWCREATED := 1 | |
| { | |
| WinGetTitle, Title, ahk_id %lParam% | |
| If ( Title = "WorkRest" ) | |
| WinClose, ahk_id %lParam% ; close it immideately | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment