Hey, I'm building a simple little program for minecraft to reduce the repetitiveness, and to help me along, I'm using getpixel, it's slow, but i only need to grab about 6-12 pixels.

but the problem is, I can get the pixel data if I capture from the entire desktop display, but as soon as I tell it to grab from the active window (wich goes MUCH faster) it doesn't return any colour value's.

any Idea why that is? I'd rather not have to use getDIBits or program in java or anything since I want to keep it fairly kiss, and if it can't be done, then.. ah well, I'll just grab from the entire desktop, speed isn't to much of an issue, but it'll be a pain to keep the window at the same place.

any help would be awesome, thanks.

(since people always want to see code, here's the code I'm using (simplified, but compilable)

#include <Windows.h>
#include <iostream>

using namespace std;

// vvv Ignore this, it's just used for retrieving the handle of a window without giving the full window name vvvv

struct results 
    char* text;
    UINT (__stdcall*GET)(HWND,LPSTR,UINT);
    HWND hRet;

BOOL WINAPI StruEnumProc( HWND hwnd, results* stru )
    char loc_buf[128];
    stru->GET( hwnd, loc_buf, 127 );
    if( strstr( loc_buf, stru->text ) ) {
        stru->hRet = hwnd;
        return FALSE;
    return TRUE;

HWND FindWindowTitleContains( char* text )
    results res = { text, (UINT (__stdcall *)(HWND,LPSTR,UINT))GetWindowTextA, 0 };
    EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
    return res.hRet;

// ^^^^^ Ignore this ^^^^^^^^^^

// just some global variables
int colour;

int main()
	HWND handle = FindWindowTitleContains( "Minecraft" );
	HDC hdca = GetDC( handle); // make 'handle' 'NULL' to grab from the entire desktop

		colour = GetPixel(hdca, 100, 100);
		cout << colour << '\r';

	return 0;