Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pixel with 0x1000 flag (Aero) sometimes not working
#1
Hi !

I noticed that sometimes the pixel command returns weird values when using the flag 0x1000 (I'm on windows 10), under certain circumstances

For example, it always returns 0 0 0 in the calculator app

[Image: LIJ3Jar.png]

In some DirectX 11 apps or games it works with no problem


For example, World of Warcraft with DirectX11 :
[Image: limaJiB.png]

Same spot but using directX12 :

[Image: EQMpycm.png]


Here is the code i use :

Macro Pixel color
Code:
Copy      Help
int r g b rr gg bb
rep
,ifk(F10)
,,end
,w=win(mouse)
,out
,POINT p;xm p w
,_i=pixel(p.x p.y w 0x1000)
,ColorToRGB(_i r g b)
,;out F"{r} {g} {b} with Aero"
,
,_i=pixel(p.x p.y w)
,ColorToRGB(_i rr gg bb)
,;out F"{rr} {gg} {bb} without Aero"
,OnScreenDisplay(F"{r} {g} {b} with Aero[]{rr} {gg} {bb} without Aero" 1 266 2 "" 12 444 8+1+32+4 "test")
,0.2

Is there a way to fix this or maybe i'm using it wrong ?

Thanks in advance Smile
#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)
#3
I will give this a try, thanks Gintaras Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)