找回密码
 加入
搜索
查看: 2635|回复: 7

获取回车键

  [复制链接]
发表于 2009-11-4 05:40:53 | 显示全部楼层 |阅读模式

如图,怎么样实现在输入框内填入字符然后回车,确定按钮变为可用,
或者说怎么捕捉到回车键

本帖子中包含更多资源

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

×
发表于 2009-11-4 06:25:55 | 显示全部楼层
_IsPressed
--------------------------------------------------------------------------------

Check if key has been pressed


#Include <Misc.au3>
_IsPressed($sHexKey[, $vDLL = 'user32.dll'])




参数

$sHexKey Key to check for
$vDLL Handle to dll or default to user32.dll



返回值

True: 1
False: 0



注意

If calling this function repeatidly, should open 'user32.dll' and pass in handle.
Make sure to close at end of script
01 Left mouse button
02 Right mouse button
04 Middle mouse button (three-button mouse)
05 Windows 2000/XP: X1 mouse button
06 Windows 2000/XP: X2 mouse button
08 BACKSPACE key
09 TAB key
0C CLEAR key
0D ENTER key
10 SHIFT key
11 CTRL key
12 ALT key
13 PAUSE key
14 CAPS LOCK key
1B ESC key
20 SPACEBAR
21 PAGE UP key
22 PAGE DOWN key
23 END key
24 HOME key
25 LEFT ARROW key
26 UP ARROW key
27 RIGHT ARROW key
28 DOWN ARROW key
29 SELECT key
2A PRINT key
2B EXECUTE key
2C PRINT SCREEN key
2D INS key
2E DEL key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
5B Left Windows key
5C Right Windows key
60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
6A Multiply key
6B Add key
6C Separator key
6D Subtract key
6E Decimal key
6F Divide key
70 F1 key
71 F2 key
72 F3 key
73 F4 key
74 F5 key
75 F6 key
76 F7 key
77 F8 key
78 F9 key
79 F10 key
7A F11 key
7B F12 key
7C-7F F13 key - F16 key
80H-87H F17 key - F24 key
90 NUM LOCK key
91 SCROLL LOCK key
A0 Left SHIFT key
A1 Right SHIFT key
A2 Left CONTROL key
A3 Right CONTROL key
A4 Left MENU key
A5 Right MENU key
BA ;
BB =
BC ,
BD -
BE .
BF /
C0 `
DB [
DC \
DD ]

多查查帮助文档
发表于 2009-12-22 13:22:06 | 显示全部楼层
2楼强大!顶
发表于 2009-12-22 14:05:52 | 显示全部楼层
不知道这样算不算符合要求了
#include <GUIConstantsEx.au3>

GUICreate("Form1", 283, 45, 193, 125)
GUICtrlCreateInput("", 16, 8, 169, 21)
$Button1 = GUICtrlCreateButton("Button1", 200, 8, 73, 25, 0)
GUICtrlSetState ( -1, $GUI_DISABLE )

Dim $AccelKeys[1][2] = [["{Enter}", $Button1]] ;输入地址后,直接按回车即可获取结果
GUISetAccelerators($AccelKeys)
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        GUICtrlSetState ( $Button1, $GUI_ENABLE )
                        MsgBox(0,"","又可以用了")
        EndSwitch
WEnd
发表于 2009-12-22 14:49:47 | 显示全部楼层
本帖最后由 afan 于 2009-12-22 14:51 编辑

LZ是不是想只要输入框不为空按钮即可用,反之则不可用?
发表于 2009-12-22 15:20:56 | 显示全部楼层
我觉得应该是4楼的那种效果吧
发表于 2009-12-22 23:04:12 | 显示全部楼层
GUIRegisterMsg($WM_COMMAND,         "MY_WM_COMMAND")
GUIRegisterMsg($WM_MOVE,                 "MY_WM_ELSEMSG")
GUIRegisterMsg($WM_LBUTTONDOWN, "MY_WM_ELSEMSG")
GUIRegisterMsg($WM_RBUTTONDOWN, "MY_WM_ELSEMSG")
Or 4楼 记得我已经回答很多这个了
发表于 2010-2-1 19:49:25 | 显示全部楼层
学习中。。。。。。。。。。。。。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-16 22:02 , Processed in 0.080966 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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