Code:
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
Func CaptureWindowMinimized($hwnd)
Local $winData = WinGetPos($hwnd)
WinMove($hwnd,"",0,0)
WinSetOnTop($hwnd,"",1)
$HBMP = _ScreenCapture_CaptureWnd("",$hwnd,0,0,$winData[2],$winData[3],False) ;capture
WinMove($hwnd,"",@DesktopWidth-100,@DesktopHeight)
WinSetOnTop($hwnd,"",0)
$bmp = _GDIPlus_BitmapCreateFromHBITMAP($HBMP); we need the bitmap to get pixel colors
Return $bmp
EndFunc
$GUI = GUICreate("caca",800,600)
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(800,600,$hGraphic)
$hBackBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
HotKeySet("{F1}","capture")
While Sleep(5)
if GUIGetMsg() = -3 Then ExitLoop
WEnd
Func capture()
$hwnd = WinGetHandle("Game gui")
$image = CaptureWindowMinimized($hwnd)
_GDIPlus_GraphicsClear($hBackBuffer)
_GDIPlus_GraphicsDrawImage($hBackBuffer,$image,0,0)
_GDIPlus_GraphicsDrawImage($hGraphic,$hBitmap,0,0)
MsgBox(0,"",searchImage($image,4294901760,1,300))
EndFunc
Func searchImage($image,$color,$xo=1,$yo=1)
$imgW = _GDIPlus_ImageGetWidth($image)
$imgH = _GDIPlus_ImageGetHeight($image)
$currentColor = -1
For $x = $xo To $imgW
For $y = $yo To $imgH
$currentColor = _GDIPlus_BitmapGetPixel($image,$x,$y)
If $currentColor = $color Then Return $x&","&$y
Next
Next
EndFunc