Standard IP

With this little function you can format a standard ip by the given long value if the value is above the standard IP you get an error i’m tired can’t write more need to sleep in a thew hours.

Option Explicit
Public Declare Sub MemCopy Lib “kernel32” Alias “RtlMoveMemory” (Dest As Any, Src As Any, ByVal cb&)
Public Declare Function inet_ntoa Lib “wsock32.dll” (ByVal inn As Long) As Long
Public Function StandardIP(IP As Long) As String
Dim MemRet As String
Dim IPStr As Long
Dim IPStrLen As Long

MemRet = String(32, 0)
IPStr = inet_ntoa(IP)

If IPStr = 0 Then
StandardIP = “Not a valide IP address out of range (”
Exit Function
End If

’32Bit = IP Address
MemCopy ByVal MemRet, ByVal IPStr, 32

StandardIP = Left$(MemRet, 32)
End Function


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s