How do I change the IP settings of a Windows CE 6 box Programatically via C++? Functions for Windows might also work.
Simple Static IP is a free program by PcWinTech.com to help users set their IP address to static with just a few clicks. At times there may be a reason you need to have your IP address set to static. A static IP is an IP address that never changes.
I found that I can change the hostname via sethostname but couldn't find how to change IP address settings such as:
- IP Address
- DHCP
- Subnet
- Gateway
- DNS1 / DNS2
- WINS1 / WINS2
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?
3 Answers
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
NG.NG.Online Ip Changer
Ip Changer Tool
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.
Static Ip Changer Programs
Jerry CoffinCaveat: using IpHelper, AddIpAddress, does NOT change the ip address persistently.After a reboot, the original NIC settings are back.