Other Software > Developer's Corner
C++ Help
(1/1)
Codebyte:
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:
--- Code: C ---//------------------------------------------------------------------------------#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; system("pause"); 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); system("cls"); 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...
Codebyte:
nevermind... after doing some research I figured out that gameguard blocks the API calls and filters what is returned... this would make sense as to why its returning 0 for a color call...
f0dder:
nevermind... after doing some research I figured out that gameguard blocks the API calls and filters what is returned... this would make sense as to why its returning 0 for a color call...-Codebyte (February 12, 2010, 08:53 PM)
--- End quote ---
I'd be a bit surprised if GetPixel worked, GameGuard/whatever or not, as soon as you're dealing with Direct3D (and possibly even DirectDraw) accelerated games.
Navigation
[0] Message Index
Go to full version