找回密码
 加入
搜索
查看: 3015|回复: 4

[系统综合] 请教注册表生效问题!代码附上!

[复制链接]
发表于 2010-7-2 10:14:45 | 显示全部楼层 |阅读模式
请教注册表生效问题!代码附上!
为什么修改了注册表不能生效啊!请哪位大哥帮忙看看啊!
60config.ini

[config]
服务器IP=192.168.0.252
映射磁盘=O:
映射路径=\\192.168.0.252\ie60$

au3代码

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=png-0094.ico
#AutoIt3Wrapper_Outfile=60tian.exe
#AutoIt3Wrapper_Res_Comment=60天记录保存器
#AutoIt3Wrapper_Res_Description=60天记录保存器
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=网络三毛QQ23371862
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Process.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3> ;导入一个AU3自带文件,主要用其防止重复运行程序的函数

_Singleton("TheNameOfMy") ;这个函数就是用来检测是否有相同程序在运行如果有则退出,就是只运行一次
Break(0) ;禁止退出!
Send("{NUMLOCK on}")
TraySetState(4)
;日志路径

If FileExists(@ScriptDir & "\60config.ini") Then
Else
        TrayTip("提示消息", "ie60天记录保存配置文件丢失!", 1)
        Sleep(3000)
        Qexit()
EndIf

;$time = IniRead(@ScriptDir & "\客户端配置.ini", "延时设置", "延时", "")
;Sleep($time)

$server1_ip = IniRead(@ScriptDir & "\60config.ini", "config", "服务器IP", "")
$var = Ping($server1_ip, 10)
If $var Then; also possible: If @error = 0 Then ...
        ;MsgBox(0, "Status", "测试:" & $var)
        server1()
        Exit
Else
        TrayTip("提示消息", "ie60天记录保存服务器无法链接", 3)
        Sleep(3000)
        Exit
EndIf
Func server1()
        $I_server1 = @ScriptDir & "\60config.ini"
        $I_files = IniRead($I_server1, "config", "映射磁盘", "")
        $I_fadmin = IniRead($I_server1, "config", "映射路径", "")
        ;映射驱动器
        DriveMapAdd($I_files, $I_fadmin)
                ;60天
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History", "DaysToKeep", "REG_DWORD", "0x0000003c")

        ;60天记录路径修改
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cookies", "REG_SZ", $I_files & " \%COMPUTERNAME%\Cookies")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "History", "REG_SZ", $I_files & "\%COMPUTERNAME%\History")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Cookies", "REG_SZ", $I_files & "\%COMPUTERNAME%\Cookies")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "History", "REG_SZ", $I_files & "\%COMPUTERNAME%\History")
        DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
        Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters")
        Run(@ComSpec & " /c gpupdate /force", "", 0)

EndFunc   ;==>server1
Func Qexit()
        Exit
EndFunc   ;==>Qexit
Func Terminate()

        Exit 0
EndFunc   ;==>Terminate
发表于 2010-7-2 10:21:52 | 显示全部楼层
传送门,看过一位高手写的。《刷新组策略、注册表》
Dim $Return
$Return = DllCAll("Userenv.dll","int","RefreshPolicyEx","int",1,"int",1)
If IsArray($Return) Then
        If $Return[0] <> 0 Then
                        MsgBox(0,"","操作成功.返回值:" & $Return[0])
                Else
                        MsgBox(0,"","操作失败.返回值:" & $Return[0])
                EndIf
EndIf
Exit

评分

参与人数 1威望 +2 收起 理由
afan + 2

查看全部评分

发表于 2010-7-2 10:24:39 | 显示全部楼层
再传送一个,三恨大侠博客上的http://www.lunhui.net.cn/article.asp?id=202
 楼主| 发表于 2010-7-2 14:26:12 | 显示全部楼层
各位大哥,还是不行啊!!帮我测试下代码啊1
发表于 2010-7-2 21:24:45 | 显示全部楼层
envupdate()
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 03:58 , Processed in 0.072952 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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