本文整理自网络,侵删。
获取公网ipuses msxml, RegularExpressions;
function GetPublicIP:string;var req: IXMLHTTPRequest;begin req := CoXMLHTTP.Create; req.open('get', 'http://city.ip138.com/ip2city.asp', False, EmptyStr, EmptyStr); req.send(''); Result := TRegEx.Match(req.responseText, '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}').Value; end;
获取本地ipuses IdIPWatch;
function GetNativeIP: String;var IdIPWatch: TIdIPWatch;begin IdIPWatch := TIdIPWatch.Create(nil); try Result := IdIPWatch.LocalIP; finally IdIPWatch.Free; end;end;
相关阅读 >>
Delphi 手机app打开一个安卓系统支持的文件,比如 pdf
Delphi 不管什么datetime日期格式时间格式转换都不会错了
Delphi 如何编写使stringgrid中的一列具有check功能,和checkbox效果一样
更多相关阅读请进入《Delphi》频道 >>