JumpyNET Posted August 4, 2006 Posted August 4, 2006 Is it possible to change the TCP/IP Properties from code? I need to toggle between the settings "Obtain an IP address automatically" and "Use the following address:". And for the latter one I need to specify the "IP address:" and "Subnet mask:". Any ideas? For clarity I attached a picture. Quote
Cags Posted August 4, 2006 Posted August 4, 2006 You can change it by running the netsh.exe from you application, but I'm not convinced this is the best way. Quote Anybody looking for a graduate programmer (Midlands, England)?
JumpyNET Posted August 7, 2006 Author Posted August 7, 2006 I found a class that could help on msdn, but don't know how to use it. Maybe some finds out how to use it. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkadapterconfiguration.asp Quote
MrPaul Posted August 7, 2006 Posted August 7, 2006 WMI = System.Management From a quick glance at the class, it looks like you would use the methods EnableDHCP (for obtaining an address automatically) and EnableStatic (for using a set address). Since this is a WMI class you will need to use the classes in the System.Management namespace (reference System.Management.dll) to wrap and interact with the WMI object. Having not worked with this much myself I'll leave it for someone more knowledgeable to explain this part, though it all looks fairly straightforward. Good luck. :) Quote Never trouble another for what you can do for yourself.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.