_TCPIpToName解析一个IP地址到主机名称,为什么解析不了。。我哪使用错了。#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 331, 80, 495, 472)
$input = GUICtrlCreateInput("119.75.217.56", 8, 16, 209, 21);百度IP
$Button1 = GUICtrlCreateButton("Button1", 240, 16, 73, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
TCPStartup()
$nameip = TCPNameToIP(GUICtrlRead($input))
$ipname = _TCPIpToName(GUICtrlRead($input))
If _isIP(GUICtrlRead($input)) Then
If @error Then
MsgBox(4096, "","错误")
Else
MsgBox(4096, "", $ipname)
EndIf
Else
MsgBox(0, "", $nameip)
EndIf
EndSwitch
WEnd
Func _isIP($ip)
Return StringRegExp($ip, "^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$")
EndFunc ;==>_isIP
|