[已解决]管理Windows XP用户的输入法
本帖最后由 fuinei 于 2012-4-9 12:24 编辑各位好,请问有什么比较好的方法可为Windows XP用户(Users权限)设置(并非删除)输入法呢?
如简体中文版OS默认有简体中文 - 美式键盘,中文(简体) - 智能ABC,中文(简体) - 全拼,中文(简体) - 郑码等,另外安装王码五笔86版,设置后则变为简体中文 - 美式键盘,中文(简体) - 智能ABC,中文(简体) - 全拼,王码五笔输入法86版,即删除文(简体) - 郑码,添加王码五笔86版 各位好,请问有什么比较好的方法可为Windows XP用户(Users权限)设置(并非删除)输入法呢?
如简体中文版OS默认 ...
fuinei 发表于 2012-3-31 08:52 http://www.autoitx.com/images/common/back.gif
如果你装了常见的 IMETOOL, 请运行命令: IMETOOL /?
它功能已经够强大了! 支持命令行模式管理输入法 有管理ime的api,去翻翻msdn,套过来就行了 本帖最后由 afan 于 2012-3-31 11:57 编辑
楼主的问题太多了,就不能自己研究吗? 张口的习惯养成了跟伸手没什么区别的…
我建议还是多自己找答案,那样对自己的帮助更大。 回复 4# afan
前期没处理过关于输入法的问题,一点头绪都没有,一定谨记afan版主的教导 回复 2# user3000
这个工具很强大并且支持命令行模式,测试了发现了一个奇怪的问题隐藏或缩小程序窗口都会设置失败
另外,美中不足就是这个工具命令行模式不能列出当前已添加到列表的输入法
失败Runwait($Path_IMETool & " /del3:WINZM.IME",@SW_HIDE)成功Runwait($Path_IMETool & " /del3:WINZM.IME" 回复 5# fuinei
输入法的操作一般在注册表,且与系统目录的某(些)文件互为关联,可以依此研究下,个人看法~ 大休息的还在忙工作,楼主可敬呀,但正如A版说得,遇到紧急case没人帮得了你
你在注册表HKEY_CURRENT_USER\Keyboard Layout\Preload看看,罗列出的应该是你现在设置的输入法,系统应该为每种输入法定义好了一个值项,你上网查查呗,远程修改是不可能了,再说了,user有权限做此修改呀 看看吧,这个或许对你会有帮助http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&pid=186182&ptid=16949 回复 1# fuinei
Global Const $KeyboardLayouts="E0040804"
;"E0040804"是输入法代号,不同的输入法是不同的。自己改下。
DllCall("user32.dll","int","UnloadKeyboardLayout","long",$KeyboardLayouts) 谢谢各位的指导,一定学习好好消化一下 本帖最后由 nmgwddj 于 2012-3-31 18:37 编辑
输入法顺序修改工具,输入法排序,删除无用输入法
http://blog.nmgwddj.com/?p=52
这些方法都是在论坛看到的。自己搜索不可能找不到解决办法!
#NoTrayIcon
#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\internat.exe|-1
#AutoIt3Wrapper_outfile=IME.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=输入法排序工具
#AutoIt3Wrapper_Res_Description=输入法排序工具
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=nmgwddj
#AutoIt3Wrapper_Res_Field=By|nmgwddj
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
_Singleton("test")
#region ### START Koda GUI section ### Form=
$Folder = IniRead('Path.ini', '路径', 'Path', 0);程序运行前先读取一下是否有配置文件存在。
If $CmdLine > 0 Then;设置程序加参数运行
If $CmdLine = '/Setup' Then
If FileExists(@ScriptDir & "\Data.ini") Then
Else
MsgBox(4096, "提示:", "没找到配置文件,请运行程序选择补丁文件目录.")
Exit
EndIf
Main()
Exit
Else
MsgBox(0, '', '没有这个参数')
Exit
EndIf
EndIf
Opt("TrayMenuMode", 1)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$Form1 = GUICreate("IME输入法排序工具", 289, 214)
$ListView1 = GUICtrlCreateListView("输入法名称|标志", 8, 8, 273, 145)
_GUICtrlListView_SetColumn($ListView1, 0, "输入法名称", 165, -1)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 88)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
$hImageList = _GUIImageList_Create(0, 20, 6)
_GUICtrlListView_SetImageList($ListView1, $hImageList, 1)
$Button1 = GUICtrlCreateButton("向 上", 8, 160, 51, 25)
$Button2 = GUICtrlCreateButton("向 下", 64, 160, 51, 25)
$Button3 = GUICtrlCreateButton("删 除", 120, 160, 51, 25)
$Button4 = GUICtrlCreateButton("确 定", 176, 160, 51, 25)
$Button5 = GUICtrlCreateButton("退 出", 232, 160, 51, 25)
$nmgwddj = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetSimple($nmgwddj)
_GUICtrlStatusBar_SetText($nmgwddj, "By nmgwddj")
GUISetState(@SW_SHOW)
start()
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button5
Exit
Case $Button1
up()
Case $Button2
down()
Case $Button3
Delete()
Case $Button4
Enter()
EndSwitch
WEnd
Func up()
$ViewId = _GUICtrlListView_GetSelectedIndices($ListView1)
$Gcr = GUICtrlRead(GUICtrlRead($ListView1))
$StringS = StringSplit($Gcr, '|')
If @error Then Return
$ReadText_1 = _GUICtrlListView_GetItemText($ListView1, $ViewId - 1, 0)
$ReadText_2 = _GUICtrlListView_GetItemText($ListView1, $ViewId - 1, 1)
_GUICtrlListView_SetItemText($ListView1, $ViewId - 1, $StringS)
_GUICtrlListView_SetItemText($ListView1, $ViewId - 1, $StringS, 1)
_GUICtrlListView_SetItemText($ListView1, $ViewId, $ReadText_1)
_GUICtrlListView_SetItemText($ListView1, $ViewId, $ReadText_2, 1)
_GUICtrlListView_SetItemSelected($ListView1, $ViewId - 1, True)
If _GUICtrlListView_GetSelectedIndices($ListView1) = 0 Then
GUICtrlSetState($Button1, $GUI_DISABLE)
Else
GUICtrlSetState($Button2, $GUI_ENABLE)
EndIf
EndFunc ;==>up
Func down()
$ViewId = _GUICtrlListView_GetSelectedIndices($ListView1)
$Gcr = GUICtrlRead(GUICtrlRead($ListView1))
$StringS = StringSplit($Gcr, '|')
If @error Then Return
$ReadText_1 = _GUICtrlListView_GetItemText($ListView1, $ViewId + 1, 0)
$ReadText_2 = _GUICtrlListView_GetItemText($ListView1, $ViewId + 1, 1)
_GUICtrlListView_SetItemText($ListView1, $ViewId + 1, $StringS)
_GUICtrlListView_SetItemText($ListView1, $ViewId + 1, $StringS, 1)
_GUICtrlListView_SetItemText($ListView1, $ViewId, $ReadText_1)
_GUICtrlListView_SetItemText($ListView1, $ViewId, $ReadText_2, 1)
_GUICtrlListView_SetItemSelected($ListView1, $ViewId + 1, True)
If _GUICtrlListView_GetSelectedIndices($ListView1) + 1 = _GUICtrlListView_GetItemCount($ListView1) Then
GUICtrlSetState($Button2, $GUI_DISABLE)
Else
GUICtrlSetState($Button1, $GUI_ENABLE)
EndIf
EndFunc ;==>down
Func Delete()
$ViewId = _GUICtrlListView_GetSelectedIndices($ListView1)
_GUICtrlListView_DeleteItem($ListView1, $ViewId)
EndFunc ;==>Delete
Func Enter()
FileDelete(@ScriptDir & '\Data.ini')
$All = _GUICtrlListView_GetItemCount($ListView1)
For $i = 1 To $All
IniWrite(@ScriptDir & '\Data.ini', 'Main', $i, _GUICtrlListView_GetItemText($ListView1, $i - 1, 1))
Next
If MsgBox(32 + 4, '温馨提示', '保存配置文件成功' & @CRLF & @CRLF & '是否按现有配置文件更新输入法?') = 6 Then
Main()
Else
MsgBox(32, '提示', '配置文件保存陈功' & @CRLF & @CRLF & '将配置文件放置于程序目录,就可以使用/setup参数静默修改了。')
EndIf
EndFunc ;==>Enter
Func start()
_GUICtrlListView_DeleteAllItems($ListView1)
$i = 0
While 1
$i += 1
$Rev = RegEnumVal('HKEY_CURRENT_USER\Keyboard Layout\Preload', $i)
$ReadRev = RegRead('HKEY_CURRENT_USER\Keyboard Layout\Preload', $Rev)
If @error Then ExitLoop
$ReadKey = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts' & '\' & $ReadRev, 'Layout Text')
If $ReadRev <> '00000804' Then GUICtrlCreateListViewItem($ReadKey & '|' & $ReadRev, $ListView1)
;MsgBox(0, '', $ReadRev)
WEnd
EndFunc ;==>start
Func Main()
$i = 0
While 1
$i += 1
$ReadReg = RegRead('HKEY_CURRENT_USER\Keyboard Layout\Preload', $i)
If @error Then ExitLoop
$inputMethod = DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", $ReadReg, "int", 0x1)
DllCall("user32.dll", "int", "UnloadKeyboardLayout", "long", $inputMethod)
WEnd
$i = 0
While 1
$i += 1
If RegDelete('HKEY_CURRENT_USER\Keyboard Layout\Preload', $i) <> 1 Then ExitLoop
WEnd
$IniRead = IniReadSection(@ScriptDir & '\Data.ini', 'Main')
RegWrite('HKEY_CURRENT_USER\Keyboard Layout\Preload', '1', 'REG_SZ', '00000804')
For $i = 1 To $IniRead
RegWrite('HKEY_CURRENT_USER\Keyboard Layout\Preload', $i + 1, 'REG_SZ', $IniRead[$i])
Next
$i = 0
While 1
$i += 1
$ReadReg = RegRead('HKEY_CURRENT_USER\Keyboard Layout\Preload', $i)
If @error Then ExitLoop
DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", $ReadReg, "int", 0x1)
WEnd
start()
EndFunc ;==>Main
Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
If @error Then Return $GUI_RUNDEFMSG
$IDFrom = DllStructGetData($tagNMHDR, 2)
$Event = DllStructGetData($tagNMHDR, 3)
$tagNMHDR = 0
Switch $IDFrom;选择产生事件的控件
Case $ListView1
Switch $Event; 选择产生的事件
Case $NM_CLICK ; 左击
Mouse()
Case $NM_DBLCLK ; 双击
Case $NM_RCLICK ; 右击
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func Mouse()
If _GUICtrlListView_GetSelectedIndices($ListView1) = 0 And _
_GUICtrlListView_GetSelectedIndices($ListView1) + 1 <> _
_GUICtrlListView_GetItemCount($ListView1) Then
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
Return
Else
If _GUICtrlListView_GetSelectedIndices($ListView1) + 1 = _
_GUICtrlListView_GetItemCount($ListView1) And _
_GUICtrlListView_GetSelectedIndices($ListView1) <> 0 Then
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
Return
EndIf
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
EndIf
EndFunc ;==>Mouse IMETOOL本身支持了~~~ 学习消化一下 回复 12# nmgwddj
谢谢指导,功能比较全具有IMETool的基本功能(查询输入法编号,调整输入法顺序和删除输入法)
页:
[1]
2