Alright so here it goes... I've been experimenting with creating macros based on pixel color changes... I'm not understanding why GetPixel() is returning 0 constantly when I have the target game open... I can see the cursor coordinates, but not the color value... What am I doing wrong? I need to find the color of the pixel underneath the cursor while in a full screen game window.
Here is my example I wrote in a couple minutes to output coordinates and color:
//------------------------------------------------------------------------------
#include <windows.h>
#include <iostream>
//------------------------------------------------------------------------------
using namespace std;
//------------------------------------------------------------------------------
int main(void)
{
HWND wowHandle = FindWindow(NULL, "World of Warcraft");
if(!wowHandle)
{
cout << "WoW is not open atm..." << endl;
return 0;
}
else
{
cout << "WoW is OPEN..." << endl;
ShowWindow(wowHandle, SW_SHOWNORMAL);
SetForegroundWindow(wowHandle);
while(1)
{
POINT cursorPoint;
GetCursorPos(&cursorPoint);
COLORREF color = GetPixel(GetDC(wowHandle), cursorPoint.x, cursorPoint.y);
cout << "(" << cursorPoint.x << ", " << cursorPoint.y << ")" << endl;
cout << "COLOR: " << color;
}
}
}
//------------------------------------------------------------------------------
it's probably sloppy... don't hate on the 5 minute "im at work and in a hurry on my break" coding...