Private Type HOSTENT hName As Long hAliases As Long hAddrType As Integer hLength As Integer hAddrList As Long End Type
Private Type WSADATA wversion As Integer wHighVersion As Integer szDescription(0 To WSADescription_Len) As Byte szSystemStatus(0 To WSASYS_Status_Len) As Byte iMaxSockets As Integer iMaxUdpDg As Integer lpszVendorInfo As Long End Type
Private Declare Function WSAStartup Lib "wsock32" _ (ByVal VersionReq As Long, WSADataReturn As WSADATA) As Long
Private Declare Function WSACleanup Lib "wsock32" () As Long
Private Declare Function WSAGetLastError Lib "wsock32" () As Long
Private Declare Function gethostbyaddr Lib "wsock32" _ (addr As Long, addrLen As Long, addrType As Long) As Long
Private Declare Function gethostbyname Lib "wsock32" _ (ByVal hostname As String) As Long
Private Declare Sub RtlMoveMemory Lib "kernel32" _ (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Public Function GetIP() As String On Error Resume Next Dim hostent_addr As Long Dim hst As HOSTENT Dim hostip_addr As Long Dim temp_ip_address() As Byte Dim i As Integer Dim ip_address As String
hostent_addr = gethostbyname(vbNullString) If hostent_addr = 0 Then Call MsgBox(9001, "Can't resolve hst") Exit Function End If
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.