Capture screen

function CaptureScreen:TBitmap;
var
   DC : HDC;
   ABitmap:TBitmap;
begin
     DC := GetDC (GetDesktopWindow);
     ABitmap:=TBitmap.Create;
     try
        ABitmap.Width := GetDeviceCaps (DC, HORZRES);
        ABitmap.Height := GetDeviceCaps (DC, VERTRES);
        BitBlt(ABitmap.Canvas.Handle,0,0,ABitmap.Width,ABitmap.Height,
               DC,0,0,SRCCOPY);
     finally
            ReleaseDC (GetDesktopWindow, DC);
     end;
     Result:=ABitmap;
end;

 

Copyright 2001-2005 (C) ykwong.com All rights reserved.