unit TEST;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BmpToJpg, ShellAPI, StdCtrls, ExtCtrls, IdBaseComponent,
IdComponent, IdIPWatch, IdTCPConnection, IdTCPClient;
type
TForm1 =
class(TForm)
BmpToJpeg1: TBmpToJpeg;
log: TMemo;
Timer1: TTimer;
IdIPWatch1: TIdIPWatch;
IdTCPClient1: TIdTCPClient;
procedure FormCreate(Sender: TObject);
procedure ScreenCAP(Sender: TObject);
procedure SNDBMP(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
sndstream: TStream;
b: TBitmap;
implementation
{$R *.dfm}
//Screenshot Procedure
procedure ScreenShot(activeWindow: bool; destBitmap : TBitmap) ;
var
w,h : integer;
DC : HDC;
hWin : Cardinal;
r : TRect;
begin
if activeWindow
then
begin
hWin := GetForegroundWindow;
dc := GetWindowDC(hWin) ;
GetWindowRect(hWin,r) ;
w := r.Right - r.Left;
h := r.Bottom - r.Top;
end
else
begin
hWin := GetDesktopWindow;
dc := GetDC(hWin) ;
w := GetDeviceCaps (
DC, HORZRES) ;
h := GetDeviceCaps (
DC, VERTRES) ;
end;
try
destBitmap.Width := w;
destBitmap.Height := h;
BitBlt(destBitmap.Canvas.Handle,
0,
0,
destBitmap.Width,
destBitmap.Height,
DC,
0,
0,
SRCCOPY) ;
finally
ReleaseDC(hWin,
DC) ;
end;
end;
//End of ScreenshotProcedure
procedure TForm1.FormCreate(Sender: TObject);
begin
log.text := '
';
log.lines.add('
Your IP Adress is: '+IdIpWatch1.LocalIP);
timer1.enabled:= false;
log.lines.add('
Timer deaktivated');
//Execute File
ShowMessage(ParamStr(1));
shellexecute(Application.Handle,'
open', PCHAR(ParamSTR(1)),PCHAR(ParamSTR(2)+'
'+ParamStr(3)+'
'+ParamSTR(4)+'
'+ParamSTR(5)+'
'+ParamSTR(6))
,
nil, SW_SHOW);
log.Lines.add('
Executed Application : '+ParamStr(1)+'
with Parameters : '+ParamStr(1)+'
'+ParamStr(2)+'
'+ParamStr(3)+'
'+ParamStr(4)+'
'+ParamStr(5)+'
'+ParamStr(6));
//End of Execute File
timer1.Enabled:= true;
timer1.ontimer(self);
end;
procedure TForm1.SNDBMP(Sender: TObject);
begin
with IdTCPClient1
do
begin
Connect;
try
OpenWriteBuffer;
try
WriteStream(sndstream, true, true, 0);
CloseWriteBuffer;
except
CancelWriteBuffer;
raise;
end;
finally
Disconnect;
end;
end;
end;
procedure TForm1.ScreenCAP(Sender: TObject);
begin
b := TBitmap.Create;
try
ScreenShot(TRUE, b);
b.SaveToStream(sndstream);
SNDBMP(sndstream);
sndstream.Free;
finally
b.FreeImage;
FreeAndNil(b);
end;
end;
end.