Ver Mensaje Individual
  #3  
Antiguo 06-06-2013
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Reputación: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
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
Responder Con Cita