Changing Computer Name and Setting IP Address
Keywords: cSetIPAddress Set IP Address
Question:
I want to do various things in the Network dialog, including specifying the computer name, and
setting the IP address. Any sample code?
Answer:
Here's some code that gets you 3/4 of the way there.
AddExtender("wwctl34I.dll")
;Change Computer name
Snam="jupiter"
IntControl(76, Snam, 0, 0, 0)
;Change Ip Address
Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl")
netwnd=DllHwnd("Network")
tabtitle="Configuration"
systabwnd=cWndByClass(netwnd,"SysTabControl")
tabwnd=cSetTabItem(systabwnd,1)
identwnd=cWndByName(netwnd,tabtitle)
listbx=cWndByID(identwnd,404)
response=cGetLBText(listbx)
response2=strreplace(response,@tab,@crlf)
;message("",response2)
response=strupper(response)
count=ItemCount(response,@tab)
;message("",count)
for i=1 to count
theitem=ItemExtract(i,response,@tab)
first3=StrSub(theitem,1,3)
if first3=="TCP"
cSetLBItem(listbx,i)
TimeDelay(1)
SendkeysTo("Network", "!r") ;Launch Properties window
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;and then do subsequent sendkeys here to set the IP address
;using the magic function: cSetIPAddress
;~~~~~~~~~~~~~~~~~~~~~~~~~~~
endif
next
Article ID: W12513
Filename: How to Set Various Network Properties including IP.txt