Jump to content

Help me find an error in my "script"


Recommended Posts

Hi guys, me again

i am trying to get my script working.... when i take screen shot of certain area of my screen i want to read it and search for 1 pixel inside.

So i took some examples from this forum but i still cant get it wroking...

Were is my code:

global $colorrepot = "4227644700"

do

_GDIPlus_Startup()

$hBitmap = _ScreenCapture_Capture("",539,638,558,654,False)

$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

$pixel=_GDIPlus_BitmapGetPixel($hImage,322,345)

TrayTip("Pixel Color",$pixel,1) ; <- this is only for my info and will be removed later on

sleep(200)

MouseDown("right")

until $pixel=$colorrepot

sleep(200)

MouseUp("right")

sleep(200)

call("function1") ;

EndFunc

func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY)

Local $tArgb, $pArgb, $aRet

$tArgb = DllStructCreate("dword Argb")

$pArgb = DllStructGetPtr($tArgb)

$aRet = DllCall($ghGDIPDll, "int", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "ptr", $pArgb)

Return DllStructGetData($tArgb, "Argb")

EndFunc ;==>_GDIPlus_BitmapGetPixel

So...my question is what sould i fix so i will get CORRECT readings from this -> ("",539,638,558,654,False) region?

ty all for your help!

Link to comment
Share on other sites

Wouldn't it be easier to just use the built-in function PixelGetColor()? Unless there's a particular reason you want to work with GDI+ instead of GDI...

because of built in anti cheat software you can get cour from main windows (it returns black or "0000000" all the time).

So what i need is to take a screen shot of a particular region, analyize it and then act acordingly.

So atm my problem is that i take screen shot, i search for the colour but it kinda doesnt work.

I need help from someone who knows how to fix this.

(allso i cant find some function of GDI+ in my help file :S )

anyway someone plz take a look at my script

ty

Link to comment
Share on other sites

First of all, I don't recognize "GdipBitmapGetPixel" as a standard GDI+ function. I found it here, described as part of the "flat API", which the MSDN recommends against using directly:

http://msdn.microsoft.com/en-us/library/ms...71(VS.85).aspx#

Second of all you don't have $ghGDIPDll defined anywhere (the handle to the DLL which contains the function above.) According to the above link this should be a handle to the DLL "gdiplus.dll".

I also noticed the first parameter to this function is a pointer to bitmap, not a handle to a window. So I think what you'll have to do is grab a bitmap of the window based on the hwnd, and then pass THAT as the parameter to your function.

Link to comment
Share on other sites

First of all, I don't recognize "GdipBitmapGetPixel" as a standard GDI+ function. I found it here, described as part of the "flat API", which the MSDN recommends against using directly:

http://msdn.microsoft.com/en-us/library/ms...71(VS.85).aspx#

Second of all you don't have $ghGDIPDll defined anywhere (the handle to the DLL which contains the function above.) According to the above link this should be a handle to the DLL "gdiplus.dll".

I also noticed the first parameter to this function is a pointer to bitmap, not a handle to a window. So I think what you'll have to do is grab a bitmap of the window based on the hwnd, and then pass THAT as the parameter to your function.

all right got it working now.

Thx for your help mate =)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...