获取外网IP地址
(defun getuip( address / ob html)(setq ob (vlax-create-object "Msxml2.XMLHTTP"))
(vlax-invoke-method ob "open" "get" address "false")
(if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke-method (list ob "send")))
(princ "\nµ±Ç°ÎÞÍøÂçÁ¬½Ó")
(setq html (vlax-get-property ob "responseText"))
)
(vlax-release-object ob)
html
)
(getuip "http://icanhazip.com" ) 请教大师,这可以有内网的吗?
外网可判断地区,不知如有内网的话能判断什么?
ynhh 发表于 2020-7-4 12:45
请教大师,这可以有内网的吗?
外网可判断地区,不知如有内网的话能判断什么?
可以简单的判断内网的ip地址
或者参看晓东论坛有
http://bbs.xdcad.net/forum.php?mod=viewthread&tid=714967&highlight=ping
(XD::Internet:Ping "www.baidu.com")
(defun XD::Internet:Ping (address / out ws)
(and (setq ws (vlax-get-or-create-object "WScript.Shell"))
(setq out (vlax-invoke
ws
'run
(strcat "ping.exe -n 1 " address)
0
:vlax-true
)
)
(vlax-release-object ws)
(zerop out)
)
)
页:
[1]