找回密码
 加入
搜索
查看: 1028|回复: 1

热键问题请教

[复制链接]
发表于 2009-6-3 10:48:32 | 显示全部楼层 |阅读模式
本帖最后由 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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-6-3 11:19:40 | 显示全部楼层
我觉得你改 GUI 比较好,这样的方式容易让用的人迷惑
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-28 10:20 , Processed in 0.082998 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表