# Displaying "My Network Connections" in VB



## Max_Phoenix (Feb 18, 2008)

I'm hoping someone can help me, i've searched all over the internet.

I'm writing a VB application to change the settings on a clients network (from a static IP based work network, to a DHCP home network), i've managed to get it all working ... it changes the IP settings for me, and has the option to run a ping test to an external site (to check that the connection works).

However, I was wondering if there's a way to make it detect what network connections are set-up on the computer & display them in a menu (either drop-down or radio-button list) as i currently have the network connection name hard-coded into the program.

Thanks


----------



## draceplace (Jun 8, 2001)

One file that has the 'ad hoc' connections is ;
C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk

Some Code I use to let users disconnect from our proxy server when away from our network (it loops through domain and default gateways:

Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each objAdapter in colAdapters

If Not IsNull(objAdapter.DNSDomain) Then
'WScript.Echo " DNS domain: " & objAdapter.DNSDomain
confirm = MsgBox(" DNS domain: " & objAdapter.DNSDomain, 64, Title)
End If 

If Not IsNull(objAdapter.DefaultIPGateway) Then
'WScript.Echo " Default gateway: " & objAdapter.DefaultIPGateway(i)
confirm = MsgBox(" Default gateway: " & objAdapter.DefaultIPGateway(i), 64, Title) 
If objAdapter.DefaultIPGateway(i) = ADEM_Pwire Then
GW_Hold = xxxx_Pwire
End If 
End If 

If objAdapter.DNSDomain = xxxx Then
Domain1 = xxxx
End If

n = n + 1
Next

If Domain1 = ADEM Then
Call xxxx_Proxy()
Else
Call xxxx_NoProxy()
End If

Had to do this because I couldn't get the 'proxy' GP to behave correctly...
Anyway this stuff might help.


----------



## Max_Phoenix (Feb 18, 2008)

cheers ... i'll see what i can do with it


----------

