def GetPixelColor(x: int, y: int, handle: int = <NUM_LIT:0>) -> int:
hdc = ctypes.windll.user32.GetWindowDC(ctypes.c_void_p(handle))<EOL>bgr = ctypes.windll.gdi32.GetPixel(hdc, x, y)<EOL>ctypes.windll.user32.ReleaseDC(ctypes.c_void_p(handle), hdc)<EOL>return bgr<EOL>
Get pixel color of a native window.
x: int.
y: int.
handle: int, the handle of a native window.
Return int, the bgr value of point (x,y).
r = bgr & 0x0000FF
g = (bgr & 0x00FF00) >> 8
b = (bgr & 0xFF0000) >> 16
If handle is 0, get pixel from Desktop window(root control).
Note:
Not all devices support GetPixel.
An application should call GetDeviceCaps to determine whether a specified device supports this function.
For example, console window doesn't support.