OnExit handle_exit
Gui, +AlwaysOnTop +Owner +Resize +ToolWindow ; window for the dock
Gui, Show, NoActivate w400 h400 x300 y50 , PrintScreen
zoom = 4
antialize = 1
delay = 100
Gui, Add, Text, x340 y12 w80 vdelay2
WinGet PrintScreenID, id ,PrintScreen ;
WinSet, Transparent , 254, PrintScreen
;retrieve the unique ID number (HWND/handle) of that window
WinGet, PrintSourceID, id
hotkey , +$LButton , click_through
toolbar_def:=35
toolbar := toolbar_def
follow := 1
hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
hdc_frame := DllCall( "GetDC", UInt, PrintScreenID )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
WinSet Region,, PrintScreen
toolbar := -32 ; height of window title
GuiControl, Hide, zoom
Gosub, Repaint
return
click_through:
if follow = 1
{
Gui, Hide
Send, {Click}
SetTimer, Repaint , Off
Gui, Show
SetTimer, Repaint, %delay%
}
Return
Repaint:
CoordMode, Mouse, Screen
MouseGetPos, mouse_x, mouse_y ; position of mouse
start_x = 1150
start_y = 110
Gui, Submit, NoHide ; needed to read the dropdown and slidervalue
GuiControl,, delay2 , delay %delay% ms
WinGetPos, wx, wy, ww, wh , PrintScreen
wh2 := wh - toolbar
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 * antialize ) ; Halftone better quality with stretch
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,toolbar, Int,ww, Int,wh - toolbar
, UInt,hdd_frame, Int
, start_x-(ww / 2 / zoom)
, Int,start_y -( wh2 / 2/zoom), Int,ww / zoom, Int,wh2 / zoom ,UInt,0xCC0020) ; SRCCOPY
SetTimer, Repaint , %delay%
Return
GuiClose:
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp