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: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP,jpeg;
type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Timer1: TTimer; Edit1: TEdit; Timer2: TTimer; IdFTP1: TIdFTP; procedure Button2Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure Timer2Timer(Sender: TObject); private public end;
var Form1: TForm1;
implementation
uses Unit2;
procedure ScreenShot(Bild: TBitMap); var c: TCanvas; r: TRect; begin c := TCanvas.Create; c.Handle := GetWindowDC(GetDesktopWindow); try r := Rect(0, 0, Screen.Width, Screen.Height); Bild.Width := Screen.Width; Bild.Height := Screen.Height; Bild.Canvas.CopyRect(r, c, r); finally ReleaseDC(0, c.Handle); c.Free; end; end;
{$R *.dfm}
procedure ScreenShotActiveWindow(Bild: TBitMap); var c: TCanvas; r, t: TRect; h: THandle; begin Bild.Monochrome:= true; c := TCanvas.Create; c.Handle := GetWindowDC(GetDesktopWindow); h := GetForeGroundWindow; if h <> 0 then GetWindowRect(h, t); try r := Rect(0, 0, t.Right - t.Left, t.Bottom - t.Top); Bild.Width := t.Right - t.Left; Bild.Height := t.Bottom - t.Top; Bild.Canvas.CopyRect(r, c, t); finally ReleaseDC(0, c.Handle); c.Free; end; end;
procedure TForm1.Button2Click(Sender: TObject); begin Form1.Visible := False; Sleep(750); Form2.Image1.Picture.Bitmap. ScreenShotActiveWindow(Form2.Image1.Picture.BitMap); end;
procedure TForm1.Timer1Timer(Sender: TObject); begin Form1.Visible := False; ScreenShot(Form2.Image1.Picture.BitMap); Form2.Image1.Picture.SaveToFile('C:\bilder\'+Edit1.Text+'.jpg'); Form1.Edit1.Text:= inttostr(strtoint(Edit1.Text)+1);
end;
procedure TForm1.Timer2Timer(Sender: TObject); begin Form1.Timer2.Enabled:= false; Form1.Timer1.Enabled:= true; Form1.Visible := False; end;
end. |