Cannot get pixels from some windows, for example Chrome and Windows Store apps, including Calculator.
Try this function. The speed not tested, probably slow, because gets all window pixels, not 1. If need multiple pixels, don't call this function multiple times, but edit it to get multiple pixels from same b.dc.
Function PixelPW
Try this function. The speed not tested, probably slow, because gets all window pixels, not 1. If need multiple pixels, don't call this function multiple times, but edit it to get multiple pixels from same b.dc.
Function PixelPW
;/
function# w x y
;Gets pixel color 0xBBGGRR from window using API PrintWindow.
;The window can be in background (behind other windows), but cannot be hidden or minimized.
;w - window. To find window can be used function <help>win</help>.
;x, y - coordinates in w client area.
;REMARKS
;On Windows 10 works with windows where <help>pixel</help> with flag 0x1000 fails, for example Chrome and Windows Store apps.
;Does not work with DPI-scaled windows.
if(!w) w=win; if(!w) ret
RECT r; GetClientRect(w &r)
if(!PtInRect(&r x y)) end "x y not in window"
__MemBmp b.Create(r.right-r.left r.bottom-r.top)
if(!PrintWindow(w b.dc iif(_winver>=0xA00 3 1))) ret
ret GetPixel(b.dc x y)