Serg Posted March 16, 2010 Share Posted March 16, 2010 Hi all,Is there a way to programmatically change every network setting that is available through network connections in explorer?I mean when you right click on local area connection->select properties->networking tab->tcpip->properties. There you can change the ip address, subnet mask, default gateway, dns.I want to know exactly how does the windows explorer changes these settings (programmatically).Thank you,Serg. Link to comment Share on other sites More sharing options...
HX1 Posted March 16, 2010 Share Posted March 16, 2010 What operating system are you using? These things vary a little from OS to OS.. Link to comment Share on other sites More sharing options...
BBs Posted March 16, 2010 Share Posted March 16, 2010 The settings are changed in the registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx}"EnableDHCP""IPAddress""SubnetMask""DefaultGateway"and other settings everything is there!Not actually sure if something changes if you play with the values, you can try it if you want to find out!{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx} = I have a few of these, one should be your default settings. Link to comment Share on other sites More sharing options...
Bizarre™ Posted March 16, 2010 Share Posted March 16, 2010 The parameters in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\ is automatically laid out whenever you turn your computer on.I believe if you mess with some parameters it can either make or break your internet connection. Link to comment Share on other sites More sharing options...
implague Posted March 17, 2010 Share Posted March 17, 2010 make sure u backedup ur registry incase of ne trouble <_< Link to comment Share on other sites More sharing options...
NickH Posted March 17, 2010 Share Posted March 17, 2010 I can't help too much, but I remember an article in Computer Shopper where they use built in command line tools to save and restore interface configurations to and from a file. It was for a laptop to help it move between different locations. I'm afraid I cannot remember the command used, but there is one. You do not have to tinker with the registry. Link to comment Share on other sites More sharing options...
NickH Posted March 17, 2010 Share Posted March 17, 2010 Not good form to reply to my own post, but look up the command netsh.exe. Link to comment Share on other sites More sharing options...
Serg Posted March 17, 2010 Author Share Posted March 17, 2010 Thank you all for your replies, but isn't there some Windows API for that purpose?If I change the values in the registry, I must reboot the PC for the changes to take effect.Isn't Windows explorer uses some API to change these settings without rebooting?By the way, the OS is XP PRO SP3.Thank you,Serg Link to comment Share on other sites More sharing options...
mara- Posted March 17, 2010 Share Posted March 17, 2010 Here is how you set ip address, mask, gateway:netsh interface ip set address name ="name of connection" source = static addr = xxx.xxx.xxx.xxx mask = xxx.xxx.xxx.xxx gateway = xxx.xxx.xxx.xxx gwmetric = 1 Here's how you restore it to automatic:netsh interface ip set address name="name of connection" source=dhcp Cheers ;) Link to comment Share on other sites More sharing options...
Serg Posted March 21, 2010 Author Share Posted March 21, 2010 Here is how you set ip address, mask, gateway:netsh interface ip set address name ="name of connection" source = static addr = xxx.xxx.xxx.xxx mask = xxx.xxx.xxx.xxx gateway = xxx.xxx.xxx.xxx gwmetric = 1 Here's how you restore it to automatic:netsh interface ip set address name="name of connection" source=dhcp Cheers ;)Thank you for that,so there are no API function that doing exactly the same as netsh?Serg. Link to comment Share on other sites More sharing options...
mara- Posted March 21, 2010 Share Posted March 21, 2010 Well maybe there is, but I'm not aware of it. But commands I gave you should solve your issue.Cheers ;) Link to comment Share on other sites More sharing options...
Serg Posted March 21, 2010 Author Share Posted March 21, 2010 Well maybe there is, but I'm not aware of it. But commands I gave you should solve your issue.Cheers ;)The commands you gave me definitely solved my issue, but not in a programmatically's elegant way.Though thank you very much for this solution.I am still waiting for someone who knows how to do it using a windows API functions.Is it possible that Microsoft does not implemented such functions? I have searched through MSDN library, and have not find any answers.Serg. Link to comment Share on other sites More sharing options...
Jota.Ce Posted March 21, 2010 Share Posted March 21, 2010 It's obvious there should be a WinAPI to do that, since all Wireless adaptors brands a custom conecction setup to set those parameters...Thanks for netsh command mara- ;) It isn't suitable for programming, but it's nice for BATs. Link to comment Share on other sites More sharing options...
Serg Posted March 22, 2010 Author Share Posted March 22, 2010 Hello all,After a lot of googling, I have dug up this Windows API function: SetAdapterIpAddress.I must say that it works perfectly for me, but the problem is that its undocumented and so may change with every update.I can hardly believe that Microsoft has no such formal API function!If someone knows anything about it, please advise!Serg. Link to comment Share on other sites More sharing options...
*dcs18 Posted March 23, 2010 Share Posted March 23, 2010 Hi all,Is there a way to programmatically change every network setting that is available through network connections in explorer?I mean when you right click on local area connection->select properties->networking tab->tcpip->properties. There you can change the ip address, subnet mask, default gateway, dns.I want to know exactly how does the windows explorer changes these settings (programmatically).Thank you,Serg.You may like to have a peep here:- B) Link to comment Share on other sites More sharing options...
Serg Posted March 23, 2010 Author Share Posted March 23, 2010 You may like to have a peep here:- B)Thank you dcs18, I will check this ebook and report here if I will find anything useful.Serg. Link to comment Share on other sites More sharing options...
*dcs18 Posted March 25, 2010 Share Posted March 25, 2010 You're welcome, Serg - have a good one. ;) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.