Unit1 procedure TForm1 AppIdle Sender TObject var Done Boolean begin i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Unit1
procedure TForm1.AppIdle(Sender: TObject; var Done: Boolean);
begin
if GetAsyncKeyState(VK_SNAPSHOT) <> 0 then begin
ScreenShot:=Tbitmap.Create;
ScreenShot.Height:=Screen.Height;
ScreenShot.Width:=Screen.Width;
DC:=GetDC(0);
bitblt(ScreenShot.Canvas.Handle, 0, 0, Screen.Width, Screen.Height,
DC, 0, 0, SRCCOPY);
Form2.Show;
end;
end;
//////////////////////////////////
Unit2
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
Form1.ScreenShot.SaveToFile('C:/sc.jpg');
ReleaseDC(0, Form1.DC);
Form1.ScreenShot.Free;
end;
end.