找回密码
 加入
搜索
查看: 2812|回复: 2

这个是计算机名修改,高手帮忙看一下

[复制链接]
发表于 2008-6-15 16:33:55 | 显示全部楼层 |阅读模式
#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 编辑 ]
发表于 2008-6-15 19:27:03 | 显示全部楼层

把BBS里面有这个 实例里面的代码复制到case $Button1下面就可以了.
发表于 2008-6-15 23:16:28 | 显示全部楼层
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[0])
        Return $Return
EndFunc   ;==>_SetComputerName
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 10:34 , Processed in 0.072445 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表