Hello everybody.
Few months ago, I've written a >network UDF.
The functions witch configure the network use WMI to do that (ex : EnableStatic method for changing the IP adress)
But now, I'm looking for a way to avoid using WMI, because somethimes, on some computers, WMI may not work.
I do not want to use an external tool or command (like netsh).
I've search for a solution on MSDN with the WinAPI fonctions (IP Helper). The functions that would allow me to add or delete an IP adress are AddIPAddress and DeleteIPAddress. But as the MSDN says :
- The IPv4 address added by the AddIPAddress function is not persistent.
- To create an IPv4 address that persists, the EnableStatic method of the Win32_NetworkAdapterConfiguration Class
Unfortunately, I don't know if there is another solution than using wmi...
My idea is to change the IP adress in the registry and then use AddIPAddress to apply the modification without restarting Windows.
Firstly : do you think my idea is realiable ?
Secondly : how can I use the AddIPAddress function ? (I'm not good at all with using WinAPI)
Thanks for your help and suggestions.