Login Register






[TUT] Get Computer Info filter_list
Author
Message
RE: [TUT] Get Computer Info #6
Sure you can get the ip adress of the computer... but the provided solution seems better to me, since getting the local ip can be tricky (because most pc's nowadays have more than 1 NIC... wired, wireless, virtual, etc..) so you could end up with several ip's, finally not knowing which one is the 'live' ip.. besides that, it gives you the local ip, not the wan ip ;-)
sorry, forgot the code..
using WMI to get all active NIC's and their ip addresses:

Code:
Private Sub iptest() Dim mc As System.Management.ManagementClass Dim mo As ManagementObject mc = New ManagementClass("Win32_NetworkAdapterConfiguration") Dim moc As ManagementObjectCollection = mc.GetInstances() Dim ips As String() For Each mo In moc If mo.Item("IPEnabled") = True Then ips = mo.Item("IPAddress") End If Next For i = 0 To ips.GetUpperBound(0) MessageBox.Show(ips(i)) Next End Sub

don't forget to add a reference to system.management.dll

Reply





Messages In This Thread
[TUT] Get Computer Info - by TeraByTe - 06-21-2011, 06:23 AM