I have found a LOT of info on searching the screen for a pixel color, but none of it even remotely definitive (as far as i can tell, because i'm rather noobish)
I understand programming on a fundemental level, but I'm new to C++
I'm hoping to figure out how to search a pixel range (ie a box with corners of x=500 y=500 through x=550 y=550)
I understand how to handle the variables and the looping but I'm having a hard time figuring out the windows handler/syntax/use of this bit of code (which keep popping up but im too noobish to understand how to use)
copied from here (http://www.daniweb.com/software-development/cpp/threads/226108/help-codescanning-screen-for-pixel-color)
/* Untested code */
COLORREF tofind = RGB(175, 163, 134);
COLORREF col;
for (int y = 0; y < 801; ++y) {
for (int x = 0; x < 1280; ++x) {
col = GetPixel( hdc, x, y );
if ( col == tofind ) {
cout << "Pixel found at: \t" << "X: "<< x << "\t\t" << "Y: " << y << "\n";
cin.ignore();
}
}
}
cin.ignore();
I understand (i THINK) that the CORREF is defining a type of variable? so "tofind" is one variable defined, and "col" is another...
the for loops... got that
i don't know how to use the col=GetPixel(hdc,x,y)... not sure what that's doing so i don't know how to use it
i think it's mostly that i keep seeing the hdc (variable?) in various forms and i'm not sure what to do with it
so i think i understand the flow here but I simply can't figure out how to make "col=GetPixel(hdc,x,y)" do anything
is it looking at the active window? or is it looking at the entire screen? what is hdc?
also if anyone has a good link to a primer for c++ that would be awesome too... specifically stuff like... what to do to use basic programming stuff to actually yield results in a windows environment
my end goal is to program a video game... long ways off... my current goal is to right a program to interact with point and click type video games