[已解决]请问如何检测Combo有键盘输入
本帖最后由 kxing 于 2010-5-18 21:06 编辑请问高手们怎样能检测出Combo控件有输入行为呢
当然,上下光标选择下拉项目不包括在内!!!
多谢高手回答!!!! 有高手能回答下吗!!!! 如果你懂得看帮助文档,那你的问题早就解决了。
#include <GUIComboBox.au3>
_GUICtrlComboBox_Create() 确实帮助文件里_GUICtrlComboBox_Create()函数有示例
这里根据楼主的要求精简一下原代码,如下:#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Global $hCombo, $hGUI
$hGUI = GUICreate("检测Combo有键盘输入", 400, 96)
$hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 5, 396, 296)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF)
$iCode = BitShift($iwParam, 16)
Switch $hWndFrom
Case $hCombo, $hWndCombo
Switch $iCode
Case $CBN_EDITUPDATE
MsgBox(0, 0, '检测Combo有键盘输入!')
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND 多谢楼上的朋友了.... {:face (55):}
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("检测键盘输入", 400, 96)
$hCombo = GUICtrlCreateInput("1", 2, 5, 396, 30)
$t1 = GUICtrlRead($hCombo)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Func WM_COMMAND()
$t = GUICtrlRead($hCombo)
if $t <> $t1 then msgbox(0,"现在输入的数据","(" & $t & ")")
$t1 = GUICtrlRead($hCombo)
EndFunc
好东西,谢谢元老贡献 强人啊,谢谢分享
页:
[1]