This is kind of off the top of my head.
GetPixel returns COLORREF btw.
[php]
COLORREF color = GetPixel(...);
BYTE red = GetRValue( (DWORD)color );
cout << red << endl;
[/php]
Here is my code:
My problem is that, idk how i would make it tell me the color. Like i would put cout<<blahblha, but idk what to do. Thanks for ur help.Code:#include <iostream> #include <windows.h> #include "Getasynckeystates.h" int main() { POINT a; while(true) { HWND hwnd = FindWindow(NULL, NULL); HDC hdc = GetDC(hwnd); if(GetAsyncKeyState(sh) &1){ GetCursorPos(&a); GetPixel(hdc, a.x, a.y); Sleep(20); } } }
This is kind of off the top of my head.
GetPixel returns COLORREF btw.
[php]
COLORREF color = GetPixel(...);
BYTE red = GetRValue( (DWORD)color );
cout << red << endl;
[/php]
Last edited by Void; 09-29-2010 at 09:39 AM.
thanks void,
here is my code, it's not sending the value to the console, i am pretty sure i did something wrong, thanks for your help, I really appreciate it.Code:#include <iostream> #include <windows.h> #include "Getasynckeystates.h" int main() { POINT a; while(true) { HWND hwnd = FindWindow(NULL, NULL); HDC hdc = GetDC(hwnd); if(GetAsyncKeyState(sh) &1){ GetCursorPos(&a); COLORREF color = GetPixel(hdc, a.x, a.y); BYTE red = GetRValue(color); std::cout<<red<<"\n"; Sleep(20); } } }
btw why aren't you a junior coder anymore? you know that purple title below ur name. They should make you it again, you are one of the few people on this forum that help in every thread.
Last edited by 258456; 09-29-2010 at 10:10 AM.
press F11 and go step by step through it and everytime you should check your vars...
_____________________________________________
READING TUTORIAL:
1. READ MY POST
2. THINK ABOUT MY POST
3. PRESS THANKS
4. MAYBE CORRECT MY POSTS :P
Dijkstra:
"Computer Science is no more about computers than astronomy is about
telescopes."
THANKS BUTTON RIGHT DOWN --->
Doofbla, the reason I posted here was because I couldn't figure out what was wrong, I tried everything I could I just wanted an answer. And Stephen, u didn't help whatsoever the only person that has actually helped was void. If anyone would like to help please post but if u will just spam don't because there is no point. Doofbla I will thank anyways because u were trying to help.