Based on Sean's and Wingfat's scripts. Thank you guys!
Obsolete for Win7 users --> there is a built in Color inversion function in magnifier.
Default Hotkeys:
F9 toggles Invert screen colors
Escape ExitApp
/*===Description=========================================================================
Invert screen colors
Put together by Learning one
Based on Sean's and Wingfat's scripts
Sean: http://www.autohotkey.com/forum/topic18167.html
Wingfat: http://www.autohotkey.com/forum/topic49265.html
Thanks: Sean, Wingfat
Not perfect, high CPU usage, but saves your eyes health.
Obsolete for Win7 users --> there is a built in Color inversion function in magnifier
*/
;===Settings============================================================================
Hotkey = F9 ; toggles Invert screen colors
RepaintPeriod = 80 ; repaint screen period (don't set it too low! --> heavy CPU load)
;===Auto-execute continuation===========================================================
#SingleInstance ignore
OnExit ExitSub
Gui, +AlwaysOnTop +ToolWindow +E0x00000020
Gui, color, black
Gui, Show, na X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%, InvertScreenColors
WinSet, Transparent, 255, InvertScreenColors
Gui, -Caption
WinGet, PrintSourceID, id
hdd_frame := DllCall("GetDC", UInt, PrintSourceID)
WinGet, PrintScreenID, id, InvertScreenColors
hdc_frame := DllCall("GetDC", UInt, PrintScreenID)
DllCall("gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4)
SetTimer, Repaint, %RepaintPeriod%
Hotkey, %Hotkey%, ISC
Return ;===Auto-execute ends here===
;===Subroutines=========================================================================
Repaint:
DllCall("gdi32.dll\StretchBlt", UInt, hdc_frame, Int, 0, Int, 0, Int, A_ScreenWidth, Int, A_ScreenHeight, UInt, hdd_frame, Int, 0, Int, 0, Int, A_ScreenWidth, Int, A_ScreenHeight, UInt, 0x330008)
Return
ISC:
ISC ++
if ISC = 1
{
SetTimer, Repaint, off
Gui, hide
}
Else
{
SetTimer, Repaint, %RepaintPeriod%
Gui, show, na
ISC = 0
}
Return
ExitSub:
DllCall("gdi32.dll\DeleteDC", UInt, hdc_frame)
DllCall("gdi32.dll\DeleteDC", UInt, hdd_frame)
ExitApp
;===Exit Hotkey==========================================================================
Escape::ExitApp



Sign In
Create Account
Last active: Jul 09 2015 05:15 AM
Back to top
