How can I set my IP address programmatically?
My application is checking it, using code from DelphiTricks (although I am not sure if the code from About.com might not be better)
I want to be able to set the address programmatically for testing purposes. And (I don’t know if this is important), I want to be able to do so even I am not attached to any network (on a laptop, on a train).
To change the ip address of your network adapter you can use the
EnableStaticmethod of the Win32_NetworkAdapterConfiguration WMI class or theAddIPAddressWinApi method.Try this sample which uses the WMI.