Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pixel with 0x1000 flag (Aero) sometimes not working
#2
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
Code:
Copy      Help
;/
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)


Messages In This Thread
RE: pixel with 0x1000 flag (Aero) sometimes not working - by Gintaras - 09-07-2021, 05:58 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)