First, are you aware that according to
msdn[
^]:
The IPv4 address added by the AddIPAddress function is not persistent. Is this suitable for your needs?
Now you need the index of the IPv4 interface of the adapter you want to deal with. If you know its existing IP address, you could get its index from
GetIpAddrTable()[
^]. If, instead, you know the adapter's name, "friendly name", or MAC, you can determine the index by using
GetAdaptersAddresses()[
^].
You will find more information and some sample code at the links to Msdn.