Progress, CTGray CBBlue, % " ", Installing..., Draft Installation
Loop, Files, %A_WinDir%\system32\*.*
{
Progress, % A_Index, % A_LoopFileName, Installing..., Draft Installation
if !hStatic
ControlGet, hStatic, hwnd,, Static1, Draft Installation ahk_class AutoHotkey2
if (A_Index = 20)
StaticColor.Set(hStatic,, 0x88AAFF)
if (A_Index = 50)
StaticColor.Set(hStatic,, 0xDD00)
if (A_Index = 75)
StaticColor.Set(hStatic,, 0xBBAA00)
Sleep, 50
} until A_Index = 100
StaticColor.Set(hStatic)
Progress,,, Complete!
Sleep, 1000
ExitApp
class StaticColor
{
static arr := [], WM_CTLCOLORSTATIC := ObjBindMethod(StaticColor, "_WM_CTLCOLORSTATIC")
Set(hStatic, b_color := "", f_color := "") {
if (b_color = "" && f_color = "")
this.arr.Delete(hStatic), ( !this.arr.Count() && init := 0 )
else {
( !this.arr.Count() && init := 1 )
for k, v in ["b", "f"]
%v%_color := %v%_color >> 16 | %v%_color & 0xFF00 | (%v%_color & 0xFF) << 16
this.arr[hStatic] := {b: b_color, f: f_color}
}
( init != "" && OnMessage(0x138, this.WM_CTLCOLORSTATIC, init) )
DllCall("InvalidateRect", "Ptr", hStatic, "Ptr", 0, "Int", true)
}
_WM_CTLCOLORSTATIC(wp, lp) {
static TRANSPARENT := 1, NULL_BRUSH := 5, DC_BRUSH := 18
if !clr := this.arr[lp]
Return
( clr.f != "" && DllCall("SetTextColor", "Ptr", wp, "UInt", clr.f) )
if (clr.b = "")
DllCall("SetBkMode", "Ptr", wp, "UInt", TRANSPARENT)
else {
DllCall("SetBkColor", "Ptr", wp, "UInt", clr.b)
DllCall("SetDCBrushColor", "Ptr", wp, "UInt", clr.b)
}
Return DllCall("GetStockObject", "UInt", clr.b = "" ? NULL_BRUSH : DC_BRUSH, "Ptr")
}
}