Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 01:46

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ Pixel Search Help

Discussion on C++ Pixel Search Help within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2016
Posts: 1
Received Thanks: 0
C++ Pixel Search Help

Auto it:
Code:
 $pix = PixelSearch(0,590,177,767,0x550043)
  if IsArray($pix)  =  True Then
   EndIf
C++:
Code:
 HDC hdc;
	hdc = GetDC(GetActiveWindow());
	int x, y ;

			for(x=0; x<177;x++)
			{
		for(y=590; y<767;y++)
		{
COLORREF CC=  GetPixel( hdc, x,y );
if(CC== 4455333)
{
cout <<"found!<<endl;
}
}
}
in auto it its faster to search for the pixel >
but in c++ take 10 sec to find!
so how do i speed it in C++!!!
pra3337 is offline  
Old 01/20/2017, 10:55   #2
 
Shadow992's Avatar
 
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,878
Quote:
Originally Posted by pra3337 View Post
Auto it:
Code:
 $pix = PixelSearch(0,590,177,767,0x550043)
  if IsArray($pix)  =  True Then
   EndIf
C++:
Code:
 HDC hdc;
	hdc = GetDC(GetActiveWindow());
	int x, y ;

			for(x=0; x<177;x++)
			{
		for(y=590; y<767;y++)
		{
COLORREF CC=  GetPixel( hdc, x,y );
if(CC== 4455333)
{
cout <<"found!<<endl;
}
}
}
in auto it its faster to search for the pixel >
but in c++ take 10 sec to find!
so how do i speed it in C++!!!
You do it by learning the language! Obviously everytime calling GetPixel is slow as ****. Better get the whole Image/Screen at once, safe it to a buffer and iterate over buffer.

However there is one rule of thumb for C++ and PixelSearch:
"You do not do it in C++! You just dont!"
Shadow992 is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Little help with pixel search
05/18/2014 - AutoIt - 2 Replies
I have this piece of code, problem is when it kill mob so no more color there, he waits untill bar from mob hp dissapear from screen then he send tab and aim other mob then attack. But it need to work like, send tab until you find color (that works), send keys to kill mob (that works), send tab again after mob is dead without waiting for 5-6 seconds (that dont works). And it send keys all time, when he kill mob or search for him Global $Run = False HotKeySet("{F2}","_Attack") If $pid...
Search pixel bot
04/16/2013 - DarkOrbit - 4 Replies
Hi i search a pixel bot who can collect palla and kill alien plz or just collect
help with pixel search
08/08/2011 - AutoIt - 3 Replies
I need to implement in my autoit bot some changes and i am gonna use pixel search. What i exactly want is a script that start pressing a buton then compare a pixel if this pixel is grey make script 1 until pixel is not grey , when the pixel became not grey make script 2 till its finished, and when script 2 finish has to go to the compare pixel spot for starting again with script 1 till is not grey to make script 2 ...... and so on indefinitly it would be something like this?
Aoc Bot with Pixel search or how
07/20/2008 - General Gaming Releases - 0 Replies
Hi there sorry for my poor english I tryed a aoc bot , but i got several problems the enemys are fare away so i need to walk to them and then hit. i cannot get the next target cause first the bot need to look for 50m to see is there a enemy
Pixel search
02/23/2008 - Guild Wars - 18 Replies
hallihallo bin immoment dabei einen meiner eigenen bots zu optimieren und wollte ne Pixelsearchfunktion einbauen. Leider weiß ich nicht genau wie man das macht vorallem mit den farben. mein ziel: 3 verschiedene punkte im gw fenster(mit: x1;y1;;x2;y2;;x3;y3) sollen geprüft werden ob sie in GRÜN sind. falls x1;y1 grün ist -> (dollerzeichen)folge = 1 falls x2;y2 grün ist -> (dollerzeichen)folge = 2 falls x3;y3 grün ist -> (dollerzeichen)folge = 3



All times are GMT +1. The time now is 01:46.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.