5065366 发表于 2012-4-22 16:36:41

还有个问题,桌面快捷方式右键菜单的[已解决]

本帖最后由 5065366 于 2012-4-24 00:27 编辑

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=ie.ico
#PRE_Outfile=专用浏览器.exe
#PRE_Compression=4
#PRE_Res_Comment=Www.Xp512.Com
#PRE_Res_Description=阳光之约工作室
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=Www.Xp512.Com
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_Fileversion_AutoIncrement=Y
#PRE_Run_Obfuscator=n
#Obfuscator_Parameters=/cv 0
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region AutoIt3Wrapper 预编译参数(完整参数)
#EndRegion
_CreateIeIco("http://www.baidu.com")
Func _CreateIeIco($page)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel","{871C5380-42A0-1069-A2EA-08002B30309D}","REG_DWORD",1)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu","{871C5380-42A0-1069-A2EA-08002B30309D}","REG_DWORD",1)
        Local $path=@ProgramFilesDir&"\ClearADIE\"
        DirCreate($path)
        FileInstall("ClearADIE.exe",$path,1)
        $clsid="{20120420-0000-1982-0214-013368840871}"
        Local $ver=StringLeft(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer","Version"),1)
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\","","REG_SZ","InternetExplorer")       
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\DefaultIcon\","","REG_SZ","C:\Program Files\Internet Explorer\iexplore.exe")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\Shell\Open\", "","REG_SZ","打开主页(&H)")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\Shell\Open\Command\","","REG_SZ",Chr(34)&$path&"\ClearADIE.exe"&Chr(34)&" "&$page)
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\Shell\属性(&R)\","","REG_SZ","属性(&R)")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\Shell\属性(&R)\Command","","REG_SZ","Rundll32.exe Shell32.dll,Control_RunDLL Inetcpl.cpl")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20120420-0000-1982-0214-013368840871}\ShellFolder","","REG_DWORD",0)
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\"&$clsid,"","REG_SZ","Internet Explorer")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page","REG_SZ",$page)       
        FileDelete(@UserProfileDir&"\Application Data\Microsoft\Internet Explorer\Quick Launch\*.lnk")
        FileCreateShortcut ($path&"\ClearADIE.exe",@UserProfileDir&"\Application Data\Microsoft\Internet Explorer\Quick Launch\Internet Explorer.lnk",$path,$page,"",$path&"ClearADIE.exe",@SW_MINIMIZE)
EndFunc

还有个问题就是我用这个代码在桌面上生成Internet Explorer这个快捷方式,他的右键菜单如图:

我不想要哪个删除还有剪切,要怎么操作。因为里面写入的注册表代码。如果用注册表导入的话显示是这样的。如图:


为什么用AU3做出来后右键菜单会变成哪样?请教

kisyan 发表于 2012-4-22 18:28:59

批处理就能实现

lpxx 发表于 2012-4-22 18:54:56

本帖最后由 lpxx 于 2012-4-22 18:56 编辑

翻资料找到的,估计是你要的效果

另:论坛原因,代码复制后删除和即可。
#include <WinAPI.au3>
_index()
Func _index()
        RegWrite("HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\shell\OpenHomePage\Command", "", "REG_SZ", "C:\Program Files\Internet Explorer\iexplore.exehttp://www.autoitx.com")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\shell\OpenHomePage\Command", "", "REG_SZ", "C:\Program Files\Internet Explorer\iexplore.exehttp://www.autoitx.com")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "REG_SZ", " http://www.autoitx.com/")
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL', 'CheckedValue', 'REG_DWORD', '0x00000000')
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu", "{871C5380-42A0-1069-A2EA-08002B30309D}", "REG_DWORD", "1")
        Dim $VK_F5 = 116
        $hDesk = ControlGetHandle("", "", "SysListView321")
        _WinAPI_PostMessage($hDesk, 256, $VK_F5, 0)
        _WinAPI_PostMessage($hDesk, 257, $VK_F5, 0)
        _ReduceMemory(@AutoItPID)
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}', '', 'REG_SZ', 'Internet Explorer')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\DefaultIcon')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\DefaultIcon', '', 'REG_SZ', 'C:\Program Files\Internet Explorer\IEXPLORE.EXE')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\Open')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\Open', '', 'REG_SZ', '打开主页(&H)')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\Open\Command')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\Open\Command', '', 'REG_SZ', 'C:\Program Files\Internet Explorer\IEXPLORE.EXEhttp://www.autoitx.com')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\属性(&R)')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\属性(&R)\Command')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\Shell\属性(&R)\Command', '', 'REG_SZ', 'Rundll32.exe Shell32.dll,Control_RunDLL Inetcpl.cpl')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\ShellFolder')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{98745625-1234-1234-1234-1234567890AB}\ShellFolder', 'Attributes', 'REG_DWORD', '0x00000000')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{98745625-1234-1234-1234-1234567890AB}')
        RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{98745625-1234-1234-1234-1234567890AB}', '', 'REG_SZ', 'Internet Explorer')
EndFunc   ;==>_index
_ReduceMemory(@AutoItPID)
Func _ReduceMemory($i_PID = -1)
        If $i_PID <> -1 Then
                Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
                DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
        Else
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
        EndIf
        Return $ai_Return
        Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters")
        DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
        DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 1, "str", $bmpFile, "int", 1)
        DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "int", 0, "ptr", 0, "ptr", 0)
        DllCall("Userenv.dll", "int", "RefreshPolicyEx", "int", 1, "int", 1)
EndFunc   ;==>_ReduceMemory


5065366 发表于 2012-4-22 21:15:26

谢谢,但是脚本运行不了。>运行 AU3Check (1.54.23.0)开始目录:E:\autoit3
"C:\Documents and Settings\Administrator\桌面\新建 AutoIt v3 脚本.au3"(44,94) : warning: $bmpFile: 使用前并未进行声明.
      DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 1, "str", $bmpFile,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Documents and Settings\Administrator\桌面\新建 AutoIt v3 脚本.au3"(44,94) : error: $bmpFile: 未声明的全局变量.
      DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 1, "str", $bmpFile,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Administrator\桌面\新建 AutoIt v3 脚本.au3 - 1 错误, 1 警告
ction\.=未定义的函数.

5065366 发表于 2012-4-22 21:16:26

我慢慢检查一下看看。

user3000 发表于 2012-4-22 21:31:29

回复 4# 5065366

最后的的 _ReduceMemory 函数 是整理程序自身内存, 并刷新注册表及桌面的.
完全可以把出错的代码行删除!
页: [1]
查看完整版本: 还有个问题,桌面快捷方式右键菜单的[已解决]