Te escribo una función con la que capturas el área cliente de una ventana conociendo su Handle:
Código:
HBITMAP CreateCaptureClientWindow(HWND hWnd)
{
RECT Rect;
HDC hScreenDC, hDC;
HBITMAP oldbmp, Result;
GetClientRect(hWnd, &Rect);
hScreenDC = GetDC(hWnd);
hDC = CreateCompatibleDC(0);
Result = CreateCompatibleBitmap(hScreenDC, Rect.right, Rect.bottom);
oldbmp = SelectObject(hDC, Result);
BitBlt(hDC, 0, 0, Rect.right, Rect.bottom, hScreenDC, 0, 0, SRCCOPY);
ReleaseDC(hWnd, hScreenDC);
SelectObject(hDC, oldbmp);
DeleteObject(hDC);
return Result;
}
Ejemplo de uso:
Código:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
Bitmap->Handle = CreateCaptureClientWindow(Handle);
Bitmap->SaveToFile("Window.bmp");
delete Bitmap;
}
Saludos