Reputation: 27384
How do I change the IP settings of a Windows CE 6 box Programatically via C++? Functions for Windows might also work.
I found that I can change the hostname via sethostname but couldn't find how to change IP address settings such as:
Any advice / pointers would be great. Thanks.
P.s. How would you get the box to update to those settings - is a refresh or the programming equivalent of ipconfig /renew
required?
Upvotes: 2
Views: 10993
Reputation: 175
Caveat: using IpHelper, AddIpAddress, does NOT change the ip address persistently. After a reboot, the original NIC settings are back.
Upvotes: 0
Reputation: 22904
Have you checked out the IP Helper Routines on MSDN? I think these provide some, if not all, of what you need.
**EDIT: ** Updated link. Thanks ctacke
Upvotes: 2
Reputation: 490018
Most of these fall under the IpHlp API.
You don't really change an IP address -- you use DeleteIpAddress
delete the old one, then AddIpAddress
to add the new one. You specify the subnet mask when you add an address.
It's not clearly what you want to know about DHCP. You can use DHCP via IpReleaseAddress
and IpRenewAddress
. You can get the address of the current DHCP server with GetAdaptersInfo
(among others). At least if memory serves, getting its address is mostly for information though -- since the basic idea of DHCP is to avoid manual configuration, you normally find/use it via a broadcast message.
You can set the DNS and WINS servers via the the WMI Win32_NetworkAdapterConfiguration
class (SetDNSServerSearchOrder
and SetWinsServer
)
You can adjust quite a few (most?) of the other parameters via WMI as well.
Upvotes: 3