Code:
#include <GDIPlus.au3>
#include <Misc.au3>
_GDIPlus_Startup()
AutoItSetOption("PixelCoordMode",2)
$hwnd = WinGetHandle("test")
$gui = GUICreate("currentColors",300,300)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($gui)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(300,300,$hGraphic)
$hBackBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
guisetstate()
While Sleep(5)
$color1 = PixelGetColor(0,0,$hwnd)
$color2 = PixelGetColor(150,0,$hwnd)
$color3 = PixelGetColor(0,150,$hwnd)
$color4 = PixelGetColor(150,150,$hwnd)
_GDIPlus_GraphicsClear($hBackBuffer)
_GDIPlus_BrushSetSolidColor($hBrush,"0xFF" & Hex($color1,6))
_GDIPlus_GraphicsFillRect($hBackbuffer,0,0,150,150,$hBrush)
_GDIPlus_BrushSetSolidColor($hBrush,"0xFF" & Hex($color2,6))
_GDIPlus_GraphicsFillRect($hBackbuffer,150,0,150,150,$hBrush)
_GDIPlus_BrushSetSolidColor($hBrush,"0xFF" & Hex($color3,6))
_GDIPlus_GraphicsFillRect($hBackbuffer,0,150,150,150,$hBrush)
_GDIPlus_BrushSetSolidColor($hBrush,"0xFF" & Hex($color4,6))
_GDIPlus_GraphicsFillRect($hBackbuffer,150,150,150,150,$hBrush)
_GDIPlus_GraphicsDrawImage($hGraphic,$hBitmap,0,0)
WEnd
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hBackbuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_Shutdown()