Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCP/IP and API 1

Status
Not open for further replies.

ClydeDoggie

Programmer
Jul 23, 2002
73
US
Does anyone know if you can change a computers IP address in code through the API? Thanks for the help.
 
You have be able to "shell out" and use the program IPCONFIG.EXE. I don't think there is an API call (I could be wrong) but you may be able to with Shell programming.

Hope this helps, if even a little bit. Cheers,

Drychron Red
 
hi there

i found a solution for this problem:
the ip setting for each lan-adapter are stored in the registry under keys [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{"ClassID of the Adapter"}]
and
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{"ClassID of the Adapter"}]
you can change the settigs of ip adress, gateway, dns and many other things (which were unnessesary to me) *gg*

i found out, that you have to deactivate the lan-connection and reactivate it to make it change the settings propperly.
to write in the registry with code is very simple (i dunno if you need rights for that)
only the de- and reactivation is difficult to realize by code. i don't know yet how to do so.

hope that helps

cu thedoode
 
yes i know how , i basically need to do the same thing.

My solution is to find the corresponding registry key in the win registry and change it there. Then restart the network. To find the regsitry key just put a new address in tcp/ip settings in control panel and the n look for the new address with regedit.
i can give you some of my code if you wish but it's quite buggy..
 
hi wfettich

yes, i think some code could help me
would be nice if you post it.

tnx thedoode
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top