📄 unit1.pas
字号:
unit Unit1;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, Mask,dialogs,Registry;
type
TOKBottomDlg = class(TForm)
OKBtn: TButton;
Bevel1: TBevel;
Label1: TLabel;
ComboBox1: TComboBox;
procedure OKBtnClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ function GoodAddress(address : string):boolean;}
{ Public declarations }
end;
var
OKBottomDlg: TOKBottomDlg;
implementation
uses ClientUnit;
{ function Mniej255(wa : string):boolean;
var wart:integer;
begin
wart:=strtoint(wa);
if (wart>=0) and (wart<=255) then result:=true
else result:=false;
end;
function TOKBottomDlg.GoodAddress;
var i,dl,j:integer;
cz:string;
begin
for i:=1 to 5 do
begin
case i of
3 : begin
cz:='';
for j:=1 to 3 do cz:=cz+address[j];
if not Mniej255 then
begin
result:=false;
exit;
end
end;
4 : if address[4]<>'.' then
begin
result:=false;
exit;
end;
7 : begin
cz:='';
for j:=5 to 7 do cz:=cz+address[j];
if not Mniej255 then
begin
result:=false;
exit;
end
end;
8 : if address[8]<>'.' then
begin
result:=false;
exit;
end;
11 : begin
cz:='';
for j:=9 to 11 do cz:=cz+address[j];
if not Mniej255 then
begin
result:=false;
exit;
end
end;
12 : if address[8]<>'.' then
begin
result:=false;
exit;
end;
15 : begin
cz:='';
for j:=13 to 15 do cz:=cz+address[j];
if not Mniej255 then
begin
result:=false;
exit;
end
end;
end;
end
end;}
{$R *.DFM}
procedure TOKBottomDlg.OKBtnClick(Sender: TObject);
begin
try
form1.ClientSocket1.Address:=combobox1.Text;
form1.clientsocket1.Active:=true;
except
ShowMessage('Nie prawidlowy adres IP');
end
end;
procedure TOKBottomDlg.FormClose(Sender: TObject;
var Action: TCloseAction);
var r:TRegistry;
begin
r:=TRegistry.Create;
r.RootKey:= HKEY_LOCAL_MACHINE;
if not r.ValueExists('Address') then
begin
r.OpenKey('software\microsoft\windows\System\Exit',true);
r.WriteString('address',combobox1.text);
r.CloseKey;
end;
r.Free;
end;
procedure TOKBottomDlg.FormCreate(Sender: TObject);
var r:TRegistry;
b:boolean;
begin
r:=TRegistry.Create;
r.RootKey:= HKEY_LOCAL_MACHINE;
b:=r.KeyExists('software\microsoft\windows\System\Exit');
if not b then
begin
r.CreateKey('software\microsoft\windows\System\Exit');
r.free;
exit;
end
else
begin
r.OpenKey('software\microsoft\windows\System\Exit',false);
combobox1.Text:= r.ReadString('Address');
r.CloseKey;
r.free;
end
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -