yarsye 发表于 2010-10-8 18:08:51

在Input框中检测CapsLock大小写

发个贴 放这做个标记 , 等有时间来解决

3mile 发表于 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=['未锁定','锁定']
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)
                EndSwitch
EndSwitch
EndFunc

menfan1 发表于 2010-10-9 11:34:56

楼上正解,学习一下。。

yao1377 发表于 2010-10-9 12:14:14

找了好久~~學習了..

006001 发表于 2010-10-9 13:15:29

非常感谢,也学习了.

lin0308 发表于 2010-10-9 23:43:27

学习了感谢

ghl781258 发表于 2010-10-10 09:51:06

学习了哦哦

liufenglg 发表于 2010-10-10 11:04:57

Input框中检测CapsLock大小写
为什么要检测,光input不是能判断大小写吗

guland 发表于 2010-10-10 11:26:58

回复 1# yarsye

变成密码模式就能判断大小写了 .......(*^__^*) 嘻嘻……都别喷我啊{:1_221:}#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

qqmmcc 发表于 2010-10-10 17:21:54

这个很有用,留脚印收藏学习

yarsye 发表于 2010-10-11 12:56:08

非常感谢各位仁兄 热心的回复 小弟还没仔细看各位的代码 只是那天一时想起来 想自己写个 但是没时间 发个贴标记以免日后忘记了
再次感谢各位了

5i5wei 发表于 2010-11-9 10:10:17

学习了不错 还是有点疑问

yarsye 发表于 2010-11-10 17:22:09

有疑问好啊

yarsye 发表于 2010-11-10 17:24:42

回复 9# guland


    可以判断是可以判断 但是。。。

yarsye 发表于 2010-12-1 09:21:38

回复 2# 3mile


    _WinAPI_LoWord()这个是什么意思?
我去查了下 高位 低位?看了例子还是不明白!!能否指点下?
页: [1] 2
查看完整版本: 在Input框中检测CapsLock大小写