Ich möchte gern meine sich standig ändernde IP (DFÜ)
bei jeder neu Anwahl)zu Bekannten Mailen.
Hier nun der VBA-Code
Private Declare Function gethostname Lib "WSOCK32.DLL" (ByVal _
HostName$, ByVal HostLen%) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" _
(ByVal HostName$) As Long
Private Declare Function gethostbyaddr Lib "WSOCK32.DLL" _
(ByVal addr$, ByVal laenge%, ByVal typ%) As Long
Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As _
Any, ByVal hpvSource&, ByVal cbCopy&)
Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Private Type HostDeType
hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Private Function HostByName() As String
Dim MemIp() As Byte
Dim Y%
Dim HostDeAddress&, HostIp&
Dim IPAddress$
Dim HOST As HostDeType
HostDeAddress = gethostbyname(Name)
If HostDeAddress = 0 Then
HostByName = ""
Exit Function
End If
Call RtlMoveMemory(HOST, HostDeAddress, LenB(HOST))
For Y = 0 To X
Call RtlMoveMemory(HostIp, HOST.hAddrList + 4 * Y, 4)
If HostIp = 0 Then
HostByName = ""
Exit Function
End If
Next Y
ReDim MemIp(1 To HOST.hLength)
Call RtlMoveMemory(MemIp(1), HostIp, HOST.hLength)
IPAddress = ""
For Y = 1 To HOST.hLength
IPAddress = IPAddress & MemIp(Y) & "."
Next Y
IPAddress = Left$(IPAddress, Len(IPAddress) - 1)
HostByName = IPAddress
End Function
Sub IPAdresse()
IP = HostByName
End Sub
Dieser Code gibt nur meine lokale IP (von der Netzwerkkarte) zurück.
Ich hoffe das mir jemand helfen kann
Dank Dietmar
PS: VBA Code habe ich aus HERBER.DE (hier schon einmal Dank an herber.de)