Se il risultato che vai cercando è un messaggio come questo:
"?LocalIPAddress=**.**.***.***&LocalHostName=***** **********"
Allora il codice è corretto!
Per farlo funzionare ho dovuto cambiare una linea:
codice:
Private Declare Auto Function GetPrivateProfileString Lib "kernel32.dll"_
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String,_
ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Sub ReadINI()
SourceFolder = My.Application.Info.DirectoryPath
CompletePath = SourceFolder & "\" & "config.ini"
sRetVal = GetPrivateProfileString("parametri", "DefaultPage", "", RtnStr, Len(RtnStr), CompletePath)
strHostName = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()
urlDefault = Trim(Microsoft.VisualBasic.Left(RtnStr, sRetVal) + "?LocalIPAddress=" + strIPAddress + "&LocalHostName=" + strHostName)
MsgBox(urlDefault)
End Sub
Probabilmente tu hai un Imports che io non ho inserito.
Ma dove hai copiato questo codice?