home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { TDSoft Visual Component Library }
- { }
- { Copyright (c) 2001 Daniele Teti }
- { }
- {-------------------------------------------------------}
- { For suggest, request, bug or only for sport: }
- { Daniele_Teti@hotmail.com }
- {-------------------------------------------------------}
- { }
- { }
- {*******************************************************}
-
- unit TDScreenStamp;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
-
- {$R *.DCR}
-
- type
- TTDScreenStamp = class(TComponent)
- private
- { Private declarations }
- protected
- { Protected declarations }
- public
- { Public declarations }
- function CaptureScreen:TBitmap;
- published
- { Published declarations }
- end;
-
- procedure Register;
-
- implementation
-
- procedure Register;
- begin
- RegisterComponents('TDSoft', [TTDScreenStamp]);
- end;
-
- { TTDScreenStamp }
-
- function TTDScreenStamp.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;
-
- end.
-