本文整理自网络,侵删。
procedure TForm1.Timer1Timer(Sender: TObject);
var
dir,str,CurPath,TemStr,MyURL,WebIP:String;
i,j:integer;
MyList:TStrings;
begin
Timer1.Enabled:=False;
MyList:=TStringList.Create;
CurPath:=ExtractFilePath(ParamStr(0));
i:=Pos('Program Files',CurPath);
j:=Pos('Documents and Settings',CurPath);
if i>0 then
begin
TemStr:='PROGRA~1';
CurPath:=Copy(CurPath,1,i-1)+TemStr+Copy(CurPath,i+13,Length(CurPath));
end;
if j > 0 then
begin
TemStr:='DOCUME~1';
CurPath:=Copy(CurPath,1,j-1)+TemStr+Copy(CurPath,j+22,Length(CurPath));
end;
str:='ipconfig/all >'+CurPath+'IP.txt'; //把Ipconfig/all的信息保存到本地IP.txt文件
WinExec(Pchar('cmd /c '+str),SW_HIDE);
sleep(1000);
MyList.LoadFromFile(CurPath+'IP.txt');
MyURL:='http://www.3464.com/data/ip/ip.asp'; //得到本机外网IP
WebIP:=Idhttp1.Get(MyURL);
MyList.Add('');
MyList.Add('本机外网IP为: '+WebIP);
MyList.SaveToFile(CurPath+'IP.txt');
MyList.Free;
Act_ConnetFTP; //连接FTP;
dir:=Trim(Edit5.Text);
IdFTP1.ChangeDir(dir); //进入到子目录
IdFTP1.Put(ExtractFilePath(ParamStr(0))+'IP.txt','ip.txt');
sleep(500);
DeleteFile(ExtractFilePath(ParamStr(0))+'IP.txt');
close;
end;
相关阅读 >>
Delphi firedac 连接sql server一些要注意的地方
Delphi 如何编写使stringgrid中的一列具有check功能,和checkbox效果一样
winapi 字符及字符串函数(7): ischarlower - 是否是个小写字母
Delphi firedac fdconnection 事务
Delphi android device information
Delphi 调用api打开文件 使用系统默认打开方式进行打开
更多相关阅读请进入《Delphi》频道 >>