Description: This is an UDF to get a pixel from the memory. You first take a screenshot into memory, then use the pixel grabbing function as many times as you like, then call the destroy function. Please note that all of these functions are designed towards maximum performance. This means that nothing is actually released automatically so that the end-user can keep maximum control over what happens. Author: Original method: Greenseed UDF: Manadar Download: Example: #include <_PixelGetColor.au3>
#include <Misc.au3>
$hDll = DllOpen("gdi32.dll")
$vDC = _PixelGetColor_CreateDC($hDll)
$vRegion = _PixelGetColor_CaptureRegion($vDC, 0,0,@DesktopWidth,@DesktopHeight,$hDll)
; click left mouse button to exit
While Not _IsPressed(0x01)
$aPos = MouseGetPos()
$sColor = _PixelGetColor_GetPixel($vDC, $aPos[0],$aPos[1], $hDll)
ToolTip("The color under your mouse is: " & $sColor, $aPos[0]+3, $aPos[1]+3, "_PixelGetColor_GetPixel return",$hDll)
WEnd
_PixelGetColor_ReleaseRegion($vRegion)
_PixelGetColor_ReleaseDC($vDC,$hDll)
DllClose($hDll) Benefits of using this method: It's faster for capturing more pixels at once. All the pixels can be captured at once, then read at your convenience anywhere in the script. You can capture multiple screens at once and compare them. No problems with Vista (Aero) or Windows 7. Drawbacks: It's harder to implement. _PixelGetColor.au3 Example.au3