-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample-hookinto-new-window.ahk
More file actions
75 lines (67 loc) · 1.77 KB
/
Copy pathexample-hookinto-new-window.ahk
File metadata and controls
75 lines (67 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
; Uncomment this if you want a hotkey to set it for every
; !+r::GoSub, AdjustAllWindows
; Initalise the hook
GoSub, HookWindow
; Run it once for every window
GoSub, AdjustAllWindows
Return
HookWindow:
; New Window Hook
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
ShellMessage(wParam,lParam) {
If (wParam = 1) ; HSHELL_WINDOWCREATED := 1
{
Sleep, 10
AdjustWindow(lParam)
}
}
Return
; Adjust Window
AdjustWindow(id)
{
WinId := id
WinTitle := id = "A" ? "A" : "ahk_id " . id
; This is to check if the window is shown in the alt-tab menu, you don't want to do it on every single frame
; WinGet, WinExStyle, ExStyle, %WinTitle%
; If (WinExStyle & 0x80)
; {
; Return
; }
;
; ; This is to match classes and/or processes
; WinGetClass, WinClass, %WinTitle%
; WinGet, WinProcess, ProcessName, %WinTitle%
;
; ; Explorer
; If WinClass In % "CabinetWClass"
; If WinProcess In % "explorer.exe"
; {
; WinSet, Style, -0xC00000, %WinTitle%
; }
;
; ; foobar2000
; If WinClass In % "{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}"
; {
; ; This removes titlebar AND borders, just an example
; WinSet, Style, -0xC40000, %WinTitle%
; }
;
; ; uTorrent
; If WinProcess In % "uTorrent.exe"
; {
; WinSet, Style, -0xC00000, %WinTitle%
; }
; Uncomment this and comment the above if you don't want it to work on every window
WinSet, Style, -0xC00000, %WinTitle%
}
AdjustAllWindows:
WinGet, id, list,,, Program Manager
Loop, %id%
{
AdjustWindow(id%A_Index%)
}
Return