Code: Select all
#NoEnv
SetBatchLines -1
DllCall("QueryPerformanceFrequency", "Int64*", freq)
GroupAdd ExclWindows, ahk_class Shell_TrayWnd
GroupAdd ExclWindows, ahk_class DV2ControlHost
Loop {
KeyWait RWin, D
DllCall("QueryPerformanceCounter", "Int64*", RWinDownTimestamp)
KeyWait RWin
} return
#If A_PriorKey == "RWin" and DllCall("QueryPerformanceCounter", "Int64*", RWinUpTimestamp) and 2 * (RWinUpTimestamp - RWinDownTimestamp) < freq and WinExist("A",, "ahk_group ExclWindows")
RWin Up:: PostMessage 0x112, 0xF020 ; Should minimize the active window
^RWin Up:: PostMessage 0x112, 0xF060 ; Should close the active window
#If
Code: Select all
#NoEnv
SetBatchLines -1
DllCall("QueryPerformanceFrequency", "Int64*", freq)
Loop {
KeyWait RWin, D
DllCall("QueryPerformanceCounter", "Int64*", RWinDownTimestamp)
KeyWait RWin
} return
#If A_PriorKey == "RWin" and DllCall("QueryPerformanceCounter", "Int64*", RWinUpTimestamp) and 2 * (RWinUpTimestamp - RWinDownTimestamp) < freq and DllCall("IsWindowVisible", "Ptr", hWndMin := DllCall("GetForegroundWindow", "Ptr")) and VarSetCapacity(MinWinClass, 257 << (A_IsUnicode = true)) and DllCall("GetClassName", "Ptr", hWndMin, "Str", MinWinClass, "Int", 257) and !in(MinWinClass, "Shell_TrayWnd,DV2ControlHost")
RWin Up:: DllCall("PostMessage", "Ptr", hWndMin, "UInt", 0x112, "UInt", 0xF020, "UInt", 0)
^RWin Up:: DllCall("PostMessage", "Ptr", hWndMin, "UInt", 0x112, "UInt", 0xF060, "UInt", 0)
#If
in(string, list) {
If string in list
return true
return false
}