|
本帖最后由 ghosyyy 于 2011-3-29 21:38 编辑
小弟用的绿色版UE自带的绿化程序在32位系统上很OK, 但64位系统(Win2003)上就不能添加鼠标右键菜单了, 这个绿化程序本来也不太完善, 就打算自己写一个, 呵呵.
现在这个小程序在WinXP上可以添加上右键菜单了, 还有2个没有解决的问题:
1. 64位系统上不行, 在网上查资料和在64位Windows2003上看注册表, 还是没能解决问题, 不知道少了什么东西
2. 不知道用au3如何能替换配置文件中的整行, 比如 文件中有 Language File=F:\aa bb\UltraEdit\wordfiles 这么一行, 我需要查找到Language File这行并进行路径替换
小弟也是初学au3, 望高手帮下忙, 呵呵.;
; UltraEdit 绿化工具
;
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
If @OSArch == "X86" Then
$arch = "您的系统是32位系统: " & @OSArch
$aaaa = @ScriptDir & "" & "ue32ctmn.dll"
Else
$arch = "您的系统是64位系统: " & @OSArch
$aaaa = @ScriptDir & "" & "ue64ctmn.dll"
EndIf
$explain = _
"此工具做2件事: " & @CRLF _
& " 1. 32或64位系统正确的添加UE右键菜单." & @CRLF _
& " 2. 修改UE配置文件(Uedit32.ini)中的2个路径为UE所在目录"
#Region ### START Koda GUI section ### Form=F:\360data\重要数据\桌面\current\trunk\myau3src\UE绿化工具.kxf
$gui_mainwindow = GUICreate("UltraEdit 绿化工具", 377, 154)
$gui_arch = GUICtrlCreateLabel("$arch", 14, 14, 343, 17)
$gui_explain = GUICtrlCreateLabel("$explain", 14, 37, 343, 41)
$gui_ok = GUICtrlCreateButton("绿化", 60, 89, 73, 28)
$gui_cancel = GUICtrlCreateButton("移除", 244, 89, 73, 28)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetData($gui_arch, $arch)
GUICtrlSetData($gui_explain, $explain)
; GUI MESSAGE LOOP
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $gui_ok
$ret = install()
If $ret <> 1 Then
MsgBox(0, "", "绿化不成功")
Else
MsgBox(0, "", "绿化成功")
EndIf
ExitLoop
Case $gui_cancel
$ret = uninstall()
If $ret <> 1 Then
MsgBox(0, "", "移除不成功")
Else
MsgBox(0, "", "移除成功")
EndIf
ExitLoop
EndSwitch
WEnd
Func install()
Local $ret = RegWrite("HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\UltraEdit", _
"", "REG_SZ", "{b5eedee0-c06e-11cf-8c56-444553540000}")
If $ret <> 1 Then
Return $ret
EndIf
Local $ret = RegWrite("HKEY_CLASSES_ROOT\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}\InProcServer32", _
"", "REG_SZ", $aaaa)
If $ret <> 1 Then
Return $ret
EndIf
Local $ret = RegWrite("HKEY_CLASSES_ROOT\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}\InProcServer32", _
"ThreadingModel", "REG_SZ", "Apartment")
If $ret <> 1 Then
Return $ret
EndIf
If @OSArch <> "X86" Then
Local $ret = RegWrite("HKEY_CLASSES_ROOT\Wow6432Node\*\shellex\ContextMenuHandlers\UltraEdit", _
"", "REG_SZ", "{b5eedee0-c06e-11cf-8c56-444553540000}")
If $ret <> 1 Then
Return $ret
EndIf
Local $ret = RegWrite("HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}\InProcServer32", _
"", "REG_SZ", $aaaa)
If $ret <> 1 Then
Return $ret
EndIf
Local $ret = RegWrite("HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}\InProcServer32", _
"ThreadingModel", "REG_SZ", "Apartment")
If $ret <> 1 Then
Return $ret
EndIf
EndIf
; 注册表设置马上生效
DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
Return $ret
EndFunc
Func uninstall()
Local $ret = RegDelete("HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\UltraEdit")
Local $ret = RegDelete("HKEY_CLASSES_ROOT\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}")
If @OSArch <> "X86" Then
Local $ret = RegDelete("HKEY_CLASSES_ROOT\Wow6432Node\*\shellex\ContextMenuHandlers\UltraEdit")
Local $ret = RegDelete("HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{b5eedee0-c06e-11cf-8c56-444553540000}")
EndIf
Return 1
EndFunc
|
|