找回密码
 加入
搜索
查看: 9446|回复: 19

[AU3基础] 在Input框中检测CapsLock大小写

 火.. [复制链接]
发表于 2010-10-8 18:08:51 | 显示全部楼层 |阅读模式
发个贴 放这做个标记 , 等有时间来解决
发表于 2010-10-9 11:30:12 | 显示全部楼层
回复 1# yarsye
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <winapi.au3>
#include <winapiex.au3>
#include <GuiEdit.au3>

Global $hGUI
Global Const $VK_NUMLOCK=0x14
$hGUI = GUICreate("检测Combo有键盘输入", 400, 96)
$hEDIT1 = GUICtrlCreateEdit("",2,5,396,20);
$hEDIT = GUICtrlCreateEdit("",2,25,396,20)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

Func WM_COMMAND($hWinHandle, $iMsg, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit
Local $state[2]=['未锁定','锁定']
 If Not IsHWnd($hedit) Then $hWndEdit = GUICtrlGetHandle($hedit)
 If Not IsHWnd($hedit1) Then $hWndEdit1 = GUICtrlGetHandle($hedit1)
 $hWndFrom = $lParam
 $iIDFrom = _WinAPI_LoWord($wParam)
 $iCode = _WinAPI_HiWord($wParam)
 Switch $hWndFrom
  Case $hedit, $hWndEdit,$hedit1,$hWndEdit1
   Switch $iCode
        Case $EN_SETFOCUS
                MsgBox(0,0,'CAPS LOCK:' &$state[BitAND(_WinAPI_GetKeyState($VK_NUMLOCK), 1)])
                EndSwitch
 EndSwitch
EndFunc

评分

参与人数 3金钱 +70 收起 理由
5845 + 10
republican + 30
afan + 30

查看全部评分

发表于 2010-10-9 11:34:56 | 显示全部楼层
楼上正解,学习一下。。
发表于 2010-10-9 12:14:14 | 显示全部楼层
找了好久~~學習了..
发表于 2010-10-9 13:15:29 | 显示全部楼层
非常感谢,也学习了.
发表于 2010-10-9 23:43:27 | 显示全部楼层
学习了感谢
发表于 2010-10-10 09:51:06 | 显示全部楼层
学习了哦哦
发表于 2010-10-10 11:04:57 | 显示全部楼层
Input框中检测CapsLock大小写
为什么要检测,光input不是能判断大小写吗
发表于 2010-10-10 11:26:58 | 显示全部楼层
回复 1# yarsye

变成密码模式就能判断大小写了 .......  (*^__^*) 嘻嘻……都别喷我啊
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 226, 149, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 64, 60, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

评分

参与人数 1金钱 +30 收起 理由
afan + 30 呵呵

查看全部评分

发表于 2010-10-10 17:21:54 | 显示全部楼层
这个很有用,留脚印收藏学习
 楼主| 发表于 2010-10-11 12:56:08 | 显示全部楼层
非常感谢各位仁兄 热心的回复 小弟还没仔细看各位的代码 只是那天一时想起来 想自己写个 但是没时间 发个贴标记以免日后忘记了
再次感谢各位了
发表于 2010-11-9 10:10:17 | 显示全部楼层
学习了不错 还是有点疑问
 楼主| 发表于 2010-11-10 17:22:09 | 显示全部楼层
有疑问好啊
 楼主| 发表于 2010-11-10 17:24:42 | 显示全部楼层
回复 9# guland


    可以判断是可以判断 但是。。。
 楼主| 发表于 2010-12-1 09:21:38 | 显示全部楼层
回复 2# 3mile


    _WinAPI_LoWord()这个是什么意思?
我去查了下 高位 低位?看了例子还是不明白!!能否指点下?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 13:48 , Processed in 0.093393 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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