G***@web.de
2007-03-29 20:12:36 UTC
Hi,
I have a problem finding the appropriate information on how to set a
static IP configuration (IP address, Subnet Mask, DNS, WINS, Gateway)
and enable/disable DHCP on a given adapter. I can get an enumeration
of all available network adapter and their current configuration using
the IP Helper API, but how can I programmatically (from C++) set a new
static IP configuration or switch between static and DHCP settings for
an adapter. The IP Helper API provides a function to add an IP
Address, but this is not helpful in that case because this would leave
the current (old) configuration untouched. Besides this would not
allow switching between static and DHCP settings. There's a function
DeleteIPAddress as well in the IP Helper API but for this I need the
NTEContext of the IP address which I don't have in the program,
because I didn't add this one with AddIpAddress and couldn't find any
method to retrieve a context for a present IP. Even if I could do this
there's the same problem switching to DHCP and back to static
configuration.
Regards,
Gunnar
I have a problem finding the appropriate information on how to set a
static IP configuration (IP address, Subnet Mask, DNS, WINS, Gateway)
and enable/disable DHCP on a given adapter. I can get an enumeration
of all available network adapter and their current configuration using
the IP Helper API, but how can I programmatically (from C++) set a new
static IP configuration or switch between static and DHCP settings for
an adapter. The IP Helper API provides a function to add an IP
Address, but this is not helpful in that case because this would leave
the current (old) configuration untouched. Besides this would not
allow switching between static and DHCP settings. There's a function
DeleteIPAddress as well in the IP Helper API but for this I need the
NTEContext of the IP address which I don't have in the program,
because I didn't add this one with AddIpAddress and couldn't find any
method to retrieve a context for a present IP. Even if I could do this
there's the same problem switching to DHCP and back to static
configuration.
Regards,
Gunnar