Tools Links Login

Convert long address to IP address

Converts a long address (2220112843) to it's IP address (203.59.84.132)

Original Author: Wayne D

Returns

Example:
Result = IPToString(2220112843#)

API Declarations

Type MyLong
Value As Long
End Type
Type MyIP
A As Byte
B As Byte
C As Byte
D As Byte
End Type

Code

Function IPToString(Value As Double) As String
  Dim l As MyLong
  Dim i As MyIP
  l.Value = DoubleToLong(Value)
  LSet i = l
  IPToString = i.A & "." & i.B & "." & i.C & "." & i.D
End Function
Function DoubleToLong(Value As Double) As Long
  If Value <= 2147483647 Then
    DoubleToLong = Value
  Else
    DoubleToLong = -(4294967296# - Value)
  End If
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 85 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.