Vista (ingame) screen capturing.
I'm tring to capture a ingame screen shot with my external program.
My program uses the known XP style of capturing:
Void CaptureScreen()
{
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hDesktopDC, nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC, hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,hDesktopDC,0,0,SRCCOPY);
SaveCapturedBitmap(hCaptureBitmap); //Place holder
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
}
That works fine as long is it XP or a vista desktop capture. The problam starts when in a game (OpenGL and DirectX), that the capture is allways black or on some computers (depending on configuration) and it captures the desktop behind it (with only half the title bar of the game showing in the cornor) . The active window is the game window! so how should I capture it on vista since it looks like the rendering is done somewhere else...
Thanks.

