六行代码获取本地IP

uses IdIPWatch;

function GetNativeIP: String;
var
  IdIPWatch: TIdIPWatch;
begin
  IdIPWatch := TIdIPWatch.Create(nil);
  try
    Result := IdIPWatch.LocalIP;
  finally
    IdIPWatch.Free;
  end;
end;


DelphiXE7下编写。

posted @ 2016-03-11 13:08  phlsheji  阅读(230)  评论(0编辑  收藏  举报