回复 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
|