unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ExtCtrls,
Vcl.ComCtrls,
Vcl.StdCtrls,
System.Win.ScktComp, WinSock;
type
TForm1 =
class(TForm)
Panel1: TPanel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
firEmergency: TClientSocket;
Panel2: TPanel;
connect: TTimer;
procedure CheckBox1Click(Sender: TObject);
procedure connectTimer(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked = true
then
begin
firEmergency.Port := 5555;
firEmergency.Address := '
127.0.0.1';
firEmergency.Active := true;
CheckBox2.Enabled := false;
end else
begin
firEmergency.Active := false;
end;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if CheckBox2.Checked = true
then
begin
firEmergency.Port := 5555;
firEmergency.Address := '
192.168.0.251';
firEmergency.Active := true;
CheckBox1.Enabled := false;
end else
begin
firEmergency.Active := false;
end;
end;
procedure TForm1.connectTimer(Sender: TObject);
begin
if firEmergency.Active = true
then
begin
Panel1.Color := $0080FF80;
end else
begin
Panel1.Color := $008080FF;
end;
end;
end.