这个是计算机名修改,高手帮忙看一下
#include <ButtonConstants.au3>#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$pcname = regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName")
$Form1 = GUICreate("Form1", 215, 102, 248, 246)
$Label1 = GUICtrlCreateLabel("修改计算机名", 8, 32, 76, 17)
$Input1 = GUICtrlCreateInput($pcname, 88, 27, 121, 21)
$Button1 = GUICtrlCreateButton("确定", 52, 72, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 135, 72, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button2
Exit
case $Button1
EndSwitch
WEnd
接下来这个$buttoon1要怎么写我就不清楚, 啦 , BBS里面有这个 实例 ,可是他们都是用InputBox,来写的,
我用的是窗品的,我不知道应该怎么写,谁帮我看一下, 谢谢/
[ 本帖最后由 网络凯子 于 2008-8-31 19:37 编辑 ] :face (13): :face (13):
把BBS里面有这个 实例里面的代码复制到case $Button1下面就可以了. Func _SetComputerName($Hostname, $Hostname1);设置计算机名和描述
$SetKey1 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\"
$CtrlKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\"
$Return = RegWrite($SetKey1 & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $Hostname)
RegWrite($SetKey1 & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $Hostname)
RegWrite($SetKey1 & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $Hostname)
RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters', "srvcomment", "REG_SZ", $Hostname1)
$str1 = StringRegExp($Hostname, ".*(.{3})", 1)
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters", "VirtualNetworkNumber", "REG_DWORD", "0x" & $str1)
Return $Return
EndFunc ;==>_SetComputerName
页:
[1]