Code:
        HDC myhdc;
	HWND myhwnd;
	DWORD color;
        int r, g, b;
	
	myhwnd= GetForegroundWindow();
	myhdc= GetWindowDC(myhwnd);

	POINT lp;
	GetCursorPos(&lp);

	color = GetPixel(myhdc, lp.x, lp.y);

	r = GetRValue(color );
	g = GetGValue(color );
	b = GetBValue(color );
	ReleaseDC(myhwnd,myhdc);

        FillRect(10,10,10,10, r,g,b,255);
This works fine in window mode, I know it has something to do with getting the DC but Im not quite sure how I would make it work for fullscreen or make it cross compatible between fullscreen/window modeif needed.

Thanks :]