Registriert seit: 2. Mär 2004
5.508 Beiträge
Delphi 5 Professional
|
Re: Delphi Programm schlägt den Speicher voll
13. Mai 2005, 19:15
Delphi-Quellcode:
procedure ScreenShot(OurImage:TBitmap);
var DCPuffer, DC : HDC;
Puffer : HBitmap;
x,y: integer;
begin
DC := CreateDC(' DISPLAY', nil, nil, nil);
x := screen.Width;
y := screen.height;
DCPuffer := CreateCompatibleDC( DC);
Puffer := CreateCompatibleBitmap( DC,x,y);
SelectObject(DCPuffer,Puffer);
BitBlt(DCPuffer,0,0,x,y, dc,0,0,srccopy);
OurImage.Width := x;
OurImage.Height := y;
BitBlt(OurImage.canvas.Handle,0,0,x,y,DCPuffer,0,0,srcCopy);
DeleteObject(Puffer); // <=== das hast du vergessen
DeleteDC(DCPuffer);
DeleteDC( DC)
end;
Andreas
|
|
Zitat
|