【已解决】Hotkeyset快捷键干扰抢断系统按键
本帖最后由 user11 于 2015-7-18 15:06 编辑IC读卡器,在读卡以后,会自动加一个回车,所以就用这个【回车】触发,转换功能
但是,如此设置,,win7 64旗舰版,会抢断系统的回车,难道hotkeyset是全局快捷键??
即使软件不激活,回车键也没办法使用了,,这可怎么办??试着判断窗口是否激活?貌似没用,是注册了系统消息???
求高手帮忙解决一下问题。。,能否把快捷键加在 button1 ?谢谢
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ID卡号8位转换10位", 416, 240, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
$Group1 = GUICtrlCreateGroup("", 8, 8, 401, 225)
$Label1 = GUICtrlCreateLabel("ID卡号8位转10位", 132, 34, 136, 17)
$Label2 = GUICtrlCreateLabel("原始卡号:", 46, 80, 55, 17)
$Label3 = GUICtrlCreateLabel("转换卡号:", 46, 136, 55, 17)
$Input1 = GUICtrlCreateInput("", 104, 80, 185, 21)
$Input2 = GUICtrlCreateInput("", 104, 128, 185, 21)
$Button1 = GUICtrlCreateButton("转换", 304, 80, 65, 25)
GUICtrlSetOnEvent(-1, "button1")
$Button2 = GUICtrlCreateButton("复制", 304, 128, 65, 25)
GUICtrlSetOnEvent(-1, "button2")
$Label4 = GUICtrlCreateLabel("Code By", 178, 184, 136, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
Sleep(10)
;~ If WinActive("ID卡号8位转换10位") Then
HotKeySet("{Enter}", "button1")
;~ EndIf
HotKeySet("{ESC}", "close")
WEnd
Func button1()
GUICtrlSetData($Input2, "")
$oid = StringStripWS(StringStripCR(GUICtrlRead($Input1)), 8)
$l5 = Hex(StringRight($oid, 5), 4)
$ok = StringRight($l5, 2) & StringLeft($l5, 2) & Hex(StringLeft($oid, 3), 2)
GUICtrlSetData($Input2, $ok)
EndFunc ;==>button1
Func button2()
ClipPut(StringStripWS(StringStripCR(GUICtrlRead($Input2)), 8))
MsgBox(64, "", "卡号已经复制到剪贴板")
EndFunc ;==>button2
Func close()
Exit
EndFunc ;==>close
同求。AUTOIt的快捷键就是不是当前窗口,也接管了 #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ID卡号8位转换10位", 416, 240, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
$Group1 = GUICtrlCreateGroup("", 8, 8, 401, 225)
$Label1 = GUICtrlCreateLabel("ID卡号8位转10位", 132, 34, 136, 17)
$Label2 = GUICtrlCreateLabel("原始卡号:", 46, 80, 55, 17)
$Label3 = GUICtrlCreateLabel("转换卡号:", 46, 136, 55, 17)
$Input1 = GUICtrlCreateInput("", 104, 80, 185, 21)
$Input2 = GUICtrlCreateInput("", 104, 128, 185, 21)
$Button1 = GUICtrlCreateButton("转换", 304, 80, 65, 25)
GUICtrlSetOnEvent(-1, "button1")
$Button2 = GUICtrlCreateButton("复制", 304, 128, 65, 25)
GUICtrlSetOnEvent(-1, "button2")
$Label4 = GUICtrlCreateLabel("Code By", 178, 184, 136, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Local $AccelKeys = [["{Enter}", $Button1],['{esc}', $Button2]]
GUISetAccelerators($AccelKeys)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
Sleep(10)
WEnd
Func button1()
GUICtrlSetData($Input2, "")
$oid = StringStripWS(StringStripCR(GUICtrlRead($Input1)), 8)
$l5 = Hex(StringRight($oid, 5), 4)
$ok = StringRight($l5, 2) & StringLeft($l5, 2) & Hex(StringLeft($oid, 3), 2)
GUICtrlSetData($Input2, $ok)
EndFunc ;==>button1
Func button2()
ClipPut(StringStripWS(StringStripCR(GUICtrlRead($Input2)), 8))
MsgBox(64, "", "卡号已经复制到剪贴板")
EndFunc ;==>button2
Func close()
Exit
EndFunc ;==>close #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ID卡号8位转换10位", 416, 240, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
$Group1 = GUICtrlCreateGroup("", 8, 8, 401, 225)
$Label1 = GUICtrlCreateLabel("ID卡号8位转10位", 132, 34, 136, 17)
$Label2 = GUICtrlCreateLabel("原始卡号:", 46, 80, 55, 17)
$Label3 = GUICtrlCreateLabel("转换卡号:", 46, 136, 55, 17)
$Input1 = GUICtrlCreateInput("", 104, 80, 185, 21)
$Input2 = GUICtrlCreateInput("", 104, 128, 185, 21)
$Button1 = GUICtrlCreateButton("转换", 304, 80, 65, 25)
GUICtrlSetOnEvent(-1, "button1")
$Button2 = GUICtrlCreateButton("复制", 304, 128, 65, 25)
GUICtrlSetOnEvent(-1, "button2")
$Label4 = GUICtrlCreateLabel("Code By", 178, 184, 136, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Local $AccelKeys = [["{Enter}", $Button1],['{esc}', $Button2]]
GUISetAccelerators($AccelKeys)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
Sleep(10)
WEnd
Func button1()
GUICtrlSetData($Input2, "")
$oid = StringStripWS(StringStripCR(GUICtrlRead($Input1)), 8)
$l5 = Hex(StringRight($oid, 5), 4)
$ok = StringRight($l5, 2) & StringLeft($l5, 2) & Hex(StringLeft($oid, 3), 2)
GUICtrlSetData($Input2, $ok)
EndFunc ;==>button1
Func button2()
ClipPut(StringStripWS(StringStripCR(GUICtrlRead($Input2)), 8))
MsgBox(64, "", "卡号已经复制到剪贴板")
EndFunc ;==>button2
Func close()
Exit
EndFunc ;==>close 回复 5# Alam
非常感谢,就是这样!!
但是昨天看帮助文件没搞明白,
GUISetAccelerators() 不用数组,能不能单独设置一个button的快捷键?
页:
[1]