see your host name, local IP and web ip for mp games.
LOAD DLL "iphlpapi.dll", 1
LOAD DLL "wininet.dll", 2
`Pointer
pSize AS DWORD
pHostName AS DWORD
pLocalIP AS DWORD
pWebIP AS DWORD
`-------------------------------------------------------------------------------------------
`Host Name auslesen
pSize = MAKE MEMORY(4)
CALL DLL 1, "GetNetworkParams", 0, pSize
pHostName = MAKE MEMORY(*pSize)
CALL DLL 1, "GetNetworkParams", pHostName, pSize
PRINT "Host Name: ";
HostName$ = GetString(pHostName)
PRINT HostName$
DELETE MEMORY pHostName
`-------------------------------------------------------------------------------------------
`Lokale IP auslesen
FILL MEMORY pSize, 0, 4
CALL DLL 1, "GetIpAddrTable", 0, pSize, 0
pLocalIP = MAKE MEMORY(*pSize)
CALL DLL 1, "GetIpAddrTable", pLocalIP, pSize, 0
PRINT "Lokale IP: ";
IP AS BYTE
pIP = pLocalIP + 4
FOR I = 1 to 4
IP = *pIP
LocalIP$ = LocalIP$ + STR$(IP)
IF I < 4 THEN LocalIP$ = LocalIP$ + "."
INC pIP
NEXT I
PRINT LocalIP$
DELETE MEMORY pLocalIP
`-------------------------------------------------------------------------------------------
`Web IP auslesen
pWebIP = make memory(256)
CALL DLL 2, "InternetAttemptConnect", 0
`Verbindung zum Internet testen
Connect = CALL DLL(2, "InternetCheckConnectionA", "http://checkip.dyndns.org/", 1)
IF Connect = 0 THEN PRINT "*** Keine Verbindung! ***"
hInt = CALL DLL(2, "InternetOpenA", "checkip", 0, "", "", 0)
hUrl = CALL DLL(2, "InternetOpenUrlA", hInt, "http://checkip.dyndns.org/", "", 0, 0, 0)
CALL DLL 2, "InternetReadFile", hURL, pWebIP, 256, pSize
PRINT "Web IP: ";
WebIP$ = GetString(pWebIP + 76)
WebIP$ = LEFT$(WebIP$, LEN(WebIP$) - 16)
PRINT WebIP$
CALL DLL 2, "InternetCloseHandle", hUrl
CALL DLL 2, "InternetCloseHandle", hInt
DELETE MEMORY pWebIP
DELETE MEMORY pSize
DELETE DLL 1
DELETE DLL 2
WAIT KEY
END
`-------------------------------------------------------------------------------------------
FUNCTION GetString(PTR AS DWORD)
WHILE *PTR
String$ = String$ + CHR$(*PTR)
INC PTR
ENDWHILE
ENDFUNCTION String$