title image


Smiley Re: IP-Adressen ?
Dieser Code funktioniert solange ein Rechner nur eine Netzwerkkarte und einen Internet Zugang hat! Wenn der Rechner z.B. wie meiner 3 IP-Adressen hat klappt er nicht mehr richtig!Das einzig wahre ist, dass man eine Auswahlliste erstellt, in der sich alle aktiven IP-Adressen befinden!Der beste Source finde ich den: http://www.goetz-reinecke.de/vb/VBtips/VBtip0023.shtmlDer schnelle source wenn nur 2 ip-adressen da sind:Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired&, lpWSAData As WSADATA) As LongPrivate Declare Function WSACleanup Lib "WSOCK32.DLL" () As LongPrivate Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname$) As LongPrivate Declare Function gethostname Lib "WSOCK32.DLL" (ByVal hostname$, ByVal HostLen As Long) As LongPrivate Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)Private Const WS_VERSION_REQD = &H101Private Const WSADescription_Len = 256Private Const WSASYS_Status_Len = 128Private Const SOCKET_ERROR = -1Private Type HOSTENT hName As Long hAliases As Long hAddrType As Integer hLength As Integer hAddrList As LongEnd TypePrivate 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 LongEnd TypeFunction GetInternetIP() As StringDim WSAD As WSADATADim hostname As String * 256Dim hostent_addr As LongDim host As HOSTENTDim hostip_addr As LongDim temp_ip_address() As ByteDim i As IntegerDim ip_address As StringWSAStartup WS_VERSION_REQD, WSADIf gethostname(hostname, 256) = SOCKET_ERROR Then Exit FunctionElse hostname = Trim$(hostname)End Ifhostent_addr = gethostbyname(hostname)If hostent_addr = 0 Then Exit FunctionEnd IfRtlMoveMemory host, hostent_addr, LenB(host)RtlMoveMemory hostip_addr, host.hAddrList, 4Dim tempCounter As IntegertempCounter = 0Do tempCounter = tempCounter + 1 ReDim temp_ip_address(1 To host.hLength) RtlMoveMemory temp_ip_address(1), hostip_addr, host.hLength For i = 1 To host.hLength ip_address = ip_address & temp_ip_address(i) & "." Next ip_address = Mid$(ip_address, 1, Len(ip_address) - 1) If tempCounter = 2 Then GetInternetIP = ip_address End If ip_address = "" host.hAddrList = host.hAddrList + LenB(host.hAddrList) RtlMoveMemory hostip_addr, host.hAddrList, 4Loop While (hostip_addr 0)WSACleanupEnd Function-- MfG Fabianhttp://www.virtual-dev.de

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: