procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
procedure WriteToReg(const bappHost,bappIp,aPort:string);
{ Private declarations }
public
{ Public declarations }
end;
var
fm_SerConfig: Tfm_SerConfig; Connected: boolean= false; //代表是否连接成功
implementation
uses netlist, data;
{$R *.dfm}
procedure Tfm_SerConfig.BitBtn1Click(Sender: TObject);
begin
if ((Edt_host.Text='') or (Edt_host.Text=null))
and((Edt_ip.Text='') or (Edt_host.Text=null)) then
begin
application.MessageBox('请输入服务器和IP','输入错误',
mb_iconinformation + mb_defbutton1);
exit;
end;
try
strtoint(edt_Port.text);
except
Application.MessageBox('请输入正确的端口号', '输入错误..', mb_iconinformation + mb_defbutton1);
exit;
end;
statusbar1.Panels[0].Text:='正在连接服务器,pleale wait';
statusbar1.Refresh;
screen.Cursor:=crHourGlass;
fm_data.Socket.Connected:=false;
fm_data.Socket.Host:=edt_host.Text;
fm_data.Socket.Address:=edt_ip.Text;
fm_data.Socket.Port:=strtoint(edt_port.Text);
try
screen.Cursor:=crdefault;
fm_data.Socket.Connected:=true;
application.MessageBox('连接成功','图书管理系统', mb_iconinformation + mb_defbutton1);
connected:=true;
except
screen.Cursor:=crdefault;
application.MessageBox('连接失败','图书管理系统',mb_iconinformation+mb_defbutton1);
connected:=false;
end;
//连接成功向注册表里写入应用服务器配置信息
WriteToReg(edt_Host.Text, edt_IP.Text, edt_Port.Text);
close;
end;
//利用可视化窗体来选择计算机
procedure Tfm_SerConfig.Button1Click(Sender: TObject);
begin
edt_ip.Clear;
edt_host.Text:= NetExecute(TFm_NetList);
end;
//把信息写入注册表
procedure Tfm_SerConfig.WriteToReg(const bappHost,bappIp,aPort:string);
var
reg:Tregistry;
begin
reg:=Tregistry.Create;
reg.RootKey:=HKEY_LOCAL_MACHINE;
if not reg.OpenKey('\Software\pz',false) then //如果可以创建目录
begin
reg.CreateKey('\Software\pz');
reg.OpenKey('\Software\pz',false);
end;
reg.WriteString('host',bapph
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/8/8
分布式多层数据库系统的应用(三)由毕业论文网(www.huoyuandh.com)会员上传。