ďťż

Ładny brzuch

Próbowałem zrobić screenshota bieżącego okna, ale program generuje pusty plik <_<

   hW := GetForegroundWindow;    Windows.GetClientRect(hW, myRectClt);    Windows.GetWindowRect(hW ,myRectWnd);    bmp.Height := myRectClt.Bottom;    bmp.Width := myRectClt.Left;    DCDesk := GetWindowDC(GetDesktopWindow);    BitBlt(bmp.Canvas.Handle, myRectWnd.TopLeft.X, myRectWnd.TopLeft.Y,           myRectClt.Bottom, myRectClt.Left,         DCDesk, myRectWnd.BottomRight.X, myRectWnd.BottomRight.Y, SRCCOPY);    jpg.Assign(bmp);    jpg.SaveToFile('Screen.jpg');    ReleaseDC(GetDesktopWindow, DCDesk);    bmp.Free;    jpg.Free;

Czy ktoś wie co tutaj jest nie tak? Z góry dziękuję.
Użytkownik Mr X edytował ten post 10 luty 2006, 10:18


Może   hW := GetForegroundWindow;   Windows.GetClientRect(hW, myRectClt);   Windows.GetWindowRect(hW ,myRectWnd);   bmp.Height := myRectClt.BottomRight.Y;   bmp.Width := myRectClt.BottomRight.X;   DCDesk := GetWindowDC(GetDesktopWindow);   BitBlt(   bmp.Canvas.Handle,   0,   0,   MyRectClt.Right,   MyRectClt.Bottom,   DCDesk,   MyRectWnd.TopLeft.X,   MyRectWnd.TopLeft.Y,   SRCCOPY);   jpg.Assign(bmp);   jpg.SaveToFile('Screen.jpg');   ReleaseDC(GetDesktopWindow, DCDesk);   bmp.Free;   jpg.Free;? I tak cośtam jest ucięte, ale z tym sobie poradzisz :P

procedure CurrentWindowScreen(filename:string); var c:tcanvas; b:tbitmap; w:integer; begin w:=getforegroundwindow; c:=tcanvas.Create; c.Handle:=getwindowdc(w); b:=tbitmap.Create; b.Width:=c.ClipRect.Right-c.ClipRect.Left; b.Height:=c.ClipRect.Bottom-c.ClipRect.Top; b.Canvas.CopyRect(c.ClipRect,c,c.ClipRect); b.SaveToFile(filename); b.Free; c.Free; end;

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • zsf.htw.pl
  •