D
tut mir ehrlich leid und du darfst mich von mir aus auch als google noob beschimpfen, aber leider finde ich dort nur den einen, den du schon als beispiel gepostet hast und dieses thread (ich weiß, ich bin grade mega anstrengend... sry ).... der rest ist leider mehr oder weniger nicht zu gebrauchen....
Mein volles script sieht momentan so aus:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
//GetWindowRect(hwnd, &rect);
Sleep(1000);
int x=1, y=1, i;
short rot, gruen, blau;
HDC Bildschirm;
Bildschirm = CreateDC("DISPLAY",NULL,NULL,NULL);
HWND hwnd = GetDesktopWindow();
if(!IsWindow(hwnd)) return 1;
RECT rect;
GetWindowRect(hwnd, &rect);
size_t dx = rect.right - rect.left;
size_t dy = rect.bottom - rect.top;
BITMAPINFO info;
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info.bmiHeader.biWidth = dx;
info.bmiHeader.biHeight = dy;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32; //24 würde weniger Speicher brauchen aber das auslesen der Farbinformationen etwas komplizierter machen.
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = 0;
info.bmiHeader.biXPelsPerMeter = 0;
info.bmiHeader.biYPelsPerMeter = 0;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
HBITMAP bitmap = 0;
BYTE* memory = 0;
HDC device = GetDC(hwnd);
bitmap = CreateDIBSection(device, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);
ReleaseDC(hwnd, device);
if(!bitmap || !memory) return 1;
//...
// blit the contents of the desktop (winDC)
// to the bitmap (selected in memDC)
HDC winDC = GetWindowDC(hwnd);
HDC memDC = CreateCompatibleDC(winDC);
SelectObject(memDC, bitmap);
BitBlt(memDC, 0, 0, dx, dy, winDC, 0, 0, SRCCOPY);
DeleteDC(memDC);
ReleaseDC(hwnd, winDC);
int tbytes = dx * dy * info.bmiHeader.biBitCount / 8;
for(i = 0; i < tbytes && (rot!=255 || gruen!=255 || blau!=0); ++i)
{
rot=memory[++i]; //rot
gruen=memory[++i]; //grün
blau=memory[++i]; //blau
}
DeleteObject(bitmap);
bitmap = 0;
memory = 0;
//i= 1280*1024*32/8
x= i*8/info.bmiHeader.biBitCount/dy;
y= i*8/info.bmiHeader.biBitCount/dx;
//system("Pause");
}
aber funktionieren tut es leider immernoch nicht so, wie ich es mir erhofft hatte