回复 17# yarsye
这样行不?
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <winapiex.au3>
Global Const $EN_SETFOCUS = 0x100
Global Const $EN_UPDATE = 0x400
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() = -3
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);控件ID
$iCode = _WinAPI_HiWord($wParam);消息
Switch $hWndFrom
Case $hedit, $hWndEdit,$hedit1,$hWndEdit1
Switch $iCode
Case $EN_UPDATE Or $EN_SETFOCUS
If BitAND(_WinAPI_GetKeyState($VK_NUMLOCK), 1)=1 Then
$pos=WinGetPos( "检测Combo有键盘输入", "")
ToolTip('大写锁定',$pos[0]+100,$pos[1]+25,'',1,1)
GUICtrlSetData($iIDFrom,StringRegExpReplace(GUICtrlRead($iIDFrom),'[A-Z]+',''))
Else
ToolTip('')
EndIf
EndSwitch
EndSwitch
EndFunc
|