本帖最后由 botanycc 于 2009-6-3 15:51 编辑
如图,有两个窗口,我想把两个窗口的热键都设置为回车键,但一按下回车键两边都会执行
比如我在左边的窗口输入数字,再回车就执行左边的窗口信息;如果在右边就执行右边的
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 259, 186, 193, 125)
$input1 = GUICtrlCreateInput("", 64, 48, 81, 21)
$input2 = GUICtrlCreateInput("", 164, 48, 81, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet ( "{ENTER}" , "Open")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func Open()
$path = "" & GUICtrlRead($input1) & ".txt"
If Not FileExists($path) Then
MsgBox(64, "提示", "文件不存在")
Else
ShellExecute($path)
EndIf
$path = "" & GUICtrlRead($input2) & ".txt"
If Not FileExists($path) Then
MsgBox(64, "提示", "文件不存在")
Else
ShellExecute($path)
EndIf
EndFunc
|