Advertisement
Guest User

AHK window border except firefox

a guest
Dec 20th, 2012
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Uncomment this if you want a hotkey to set it for every
  2. ; !+r::GoSub, AdjustAllWindows
  3.  
  4. ; Initalise the hook
  5. GoSub, HookWindow
  6. ; Run it once for every window
  7. GoSub, AdjustAllWindows
  8. Return
  9.  
  10. HookWindow:
  11.    ; New Window Hook
  12.     Gui +LastFound
  13.     hWnd := WinExist()
  14.  
  15.     DllCall( "RegisterShellHookWindow", UInt,hWnd )
  16.     MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
  17.     OnMessage( MsgNum, "ShellMessage" )
  18.  
  19.     ShellMessage(wParam,lParam) {
  20.         If (wParam = 1) ;  HSHELL_WINDOWCREATED := 1
  21.         {
  22.             Sleep, 10
  23.             AdjustWindow(lParam)
  24.         }
  25.     }
  26. Return
  27.  
  28. ; Adjust Window
  29. AdjustWindow(id)
  30. {
  31.     WinId := id
  32.     WinTitle := id = "A" ? "A" : "ahk_id " . id
  33.  
  34.     ; Exclude Firefox
  35.     If WinProcess Not In % "firefox.exe"
  36.     {
  37.         WinSet, Style, -0xC00000, %WinTitle%
  38.     }
  39. }
  40.  
  41. AdjustAllWindows:
  42.    WinGet, id, list,,, Program Manager
  43.     Loop, %id%
  44.     {
  45.         AdjustWindow(id%A_Index%)
  46.     }
  47. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement