txj Posted March 4, 2009 Share Posted March 4, 2009 I want to set my host's IP address, who can tell me which Win32API can do it. Link to comment Share on other sites More sharing options...
MrMitchell Posted March 4, 2009 Share Posted March 4, 2009 You can try running a cmd prompt and using it to execute a string you built... $cmd='netsh interface ip set address name="Local Area Connection" static 192.168.1.50 255.255.0.0 192.168.1.1 1' Run(@ComSpec & " /c " & $cmd, "", @SW_SHOW) Link to comment Share on other sites More sharing options...
txj Posted March 5, 2009 Author Share Posted March 5, 2009 You can try running a cmd prompt and using it to execute a string you built... $cmd='netsh interface ip set address name="Local Area Connection" static 192.168.1.50 255.255.0.0 192.168.1.1 1' Run(@ComSpec & " /c " & $cmd, "", @SW_SHOW) I tested this code, but run time is between 4~22 seconds in my 2 computers which runs Win2K, other is WinXP, too slow, so I hope to call Win32API to set my host's IP address. Link to comment Share on other sites More sharing options...
MrMitchell Posted March 5, 2009 Share Posted March 5, 2009 I didn't have a chance to test it, so I'm surprised it worked at all...at least on the first shot anyway. Good luck with your Win API... can you post it if you get it figured out? Link to comment Share on other sites More sharing options...
Authenticity Posted March 5, 2009 Share Posted March 5, 2009 try this - http://www.delphi3000.com/articles/article_4392.asp?SK=It's doing it using WMI. Good-luck, I don't believe it's faster but anyway, good-luck. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now