summaryrefslogtreecommitdiffstats
path: root/borders.ahk
blob: 877a711fd74a5d9562e5990bcad786f40061d0c2 (plain) (blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
;doesn't work via include, must run standalone

GoSub, HookWindow

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

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
    }

    WinGetClass, WinClass, %WinTitle%
    WinGet, WinProcess, ProcessName, %WinTitle%

    If WinClass In % "CabinetWClass"
    If WinProcess In % "explorer.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "ShImgVw:CPreviewWnd" ;windows xp image viewer
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "MMCMainFrame" ;windows xp mmc panes
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "MozillaWindowClass" ;firefox
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "#32770" ;windows xp date/time picker, amongst many other things
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "Photoshop.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "sumatrapdf.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "mintty.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "7zFM.exe" ;7zip
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "msaccess.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "excel.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "Notepad2.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "outlook.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "winword.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "Qt5QWindowIcon" ;owncloud client
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinProcess In % "charmap.exe"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }
    If WinClass In % "mpv"
    {
        WinSet, Style, -0xC00000, %WinTitle%
    }

}