Larva Admin
Posts : 24 Join date : 2010-06-17 Age : 39 Location : San Antonio, TX
| Subject: Pulling pixel info from Flash or Java based apps. (no Memmory read) Tue Jun 22, 2010 12:16 pm | |
| - Code:
-
#include <WinAPI.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <Array.au3>
While 1 $pos = MouseGetPos() $pix = _oL_SaveScreen_ToHex($pos[0]-1,$pos[1]-1,$pos[0],$pos[1]) ;_ArrayDisplay($pix) ToolTip($pix[1][1]) Sleep(10) WEnd
Func _oL_SaveScreen_ToHex($Left,$Top,$Right,$Bottom) $X = ($Right-$Left) $Y = ($Bottom-$Top) Dim $Output[($X+1)][($Y+1)] $Output[0][1] = $X ;How manny colomns $Output[1][0] = $Y ;How manny Rows
$hBmp = _ScreenCapture("",$Left,$Top,$Right,$Bottom) ;$hBmp = _ScreenCapture_Capture("",$Left,$Top,$Right,$Bottom) $aSize = DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $hBmp, 'int', 0, 'ptr', 0) If $aSize[0] Then $Bits = DllStructCreate('byte[' & $aSize[0] & ']') DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $hBmp, 'int', $aSize[0], 'ptr', DllStructGetPtr($Bits)) $BitHex = Hex(DllStructGetData($Bits, 1)) EndIf _WinAPI_DeleteObject($hBmp)
For $i = 1 to $X For $j = 1 to $Y $result = StringLeft($BitHex, 8) $Output[$i][$j] = $result $BitHex = StringTrimLeft($BitHex, 8) Next Next
Return $Output EndFunc
Func _ScreenCapture($sFileName = "", $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1) Local $iH, $iW, $hWnd, $hDDC, $hCDC, $hBMP, $aCursor, $aIcon
If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($SM_CXSCREEN) If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($SM_CYSCREEN) If $iRight < $iLeft Then Return SetError(-1, 0, 0) If $iBottom < $iTop Then Return SetError(-2, 0, 0)
$iW = $iRight - $iLeft $iH = $iBottom - $iTop $hWnd = _WinAPI_GetDesktopWindow() $hDDC = _WinAPI_GetDC($hWnd) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iLeft, $iTop, $SRCCOPY)
_WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP _ScreenCapture_SaveImage($sFileName, $hBMP) _WinAPI_DeleteObject($hBMP) EndFunc
| |
|