Yet another, my own magnifier.
It'll also capture transparent windows, and mouse cursor too.
Code:
/*
Esc key: Exit the application.
*/
#NoEnv
#SingleInstance, Force
SetWinDelay, 10
CoordMode, Mouse
nZ := 3 ; Zoom Factor
nW := A_ScreenWidth // 2 //2//nZ ; Width of (small) Target Rectangle
nH := A_ScreenHeight// 6 //2//nZ ; Height of (small) Target Rectangle
ToolTip, %A_Space%
WinClose, ahk_class SysShadow
WinGet, hWnd, ID, ahk_class tooltips_class32
hDC_SC := DllCall("GetDC", "Uint", 0)
hDC_LW := DllCall("GetDC", "Uint", hWnd)
hDC_TT := DllCall("GetDC", "Uint", hWnd)
DllCall("SetStretchBltMode", "Uint", hDC_TT, "int", 4)
Loop
{
MouseGetPos, xmouse, ymouse
DllCall("BitBlt", "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", hDC_SC, "int", xmouse-nW, "int", ymouse-nH, "Uint", 0x40CC0020)
; CaptureCursor(hDC_LW, nW, nH) ; Capture magnified mouse cursor too.
DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", 2*nW*nZ, "int", 2*nH*nZ, "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", 0x00CC0020)
CaptureCursor(hDC_TT, nW*nZ, nH*nZ) ; Capture un-magnified mouse cursor too.
WinMove, ahk_id %hWnd%,, xmouse-nW*nZ-1, ymouse+nH, 2*nW*nZ+2, 2*nH*nZ+2
If GetKeyState("Esc")
Break
}
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC_SC)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_LW)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_TT)
CaptureCursor(hDC, xCenter, yCenter)
{
VarSetCapacity(mi, 20, 0)
mi := Chr(20)
DllCall("GetCursorInfo", "Uint", &mi)
ptr := &mi + 4
bShow := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hCursor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
DllCall("GetIconInfo", "Uint", hCursor, "Uint", &mi)
ptr := &mi + 4
xHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
yHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hBMMask := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hBMColor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
If hBMMask
DllCall("DeleteObject", "Uint", hBMMask)
If hBMColor
DllCall("DeleteObject", "Uint", hBMColor)
If bShow
DllCall("DrawIcon", "Uint", hDC, "int", xCenter - xHotspot, "int", yCenter - yHotspot, "Uint", hCursor)
}