function InitFtp(var sMsg: string): Boolean;
begin
Result := False;
try
if not Assigned(IdFTP) then
begin
IdFTP := TIdFTP.Create(nil);
IdFTP.AutoLogin := True;
if not Assigned(IniFile) then
IniFile := TIniFile.Create('./Surport/LotParam.ini');
with IdFTP, IniFiledo
begin
Host := ReadString('FtpParam', 'Host1', '10.13.0.1');
UserName := ReadString('FtpParam', 'UserName1', 'newapp');
PassWord := ReadString('FtpParam', 'PassWord1', 'appnew');
Passive := (StrToIntDef(ReadString('FtpParam', 'Passive1', '-1'), -1) = 1);
try
IdFTP.Connect;
if not IdFTP.Connected then
begin
sMsg := '连接传输服务器失败!';
exit;
end;
except
FreeAndNil(IdFTP);
sMsg := '请检查传输配置参数是否正确或传输服务是否可用...';
exit
end;
end;
end;
Result := True;
except
end;
end;