限制用户键入组合框编辑控件的文本长度
#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_LimitText($hWnd [, $iLimit = 0])
$hWnd | 控件句柄 |
$iLimit | [可选参数] 指定文本的限制长度 |
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
$Debug_CB = False ;检查传递给 ComboBox/ComboBoxEx 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作
_Main()
Func _Main()
Local $hGUI, $hCombo
; 创建 GUI
$hGUI = GUICreate("ComboBoxEx Limit Text", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100)
GUISetState()
; 添加文件
_GUICtrlComboBoxEx_BeginUpdate($hCombo)
_GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate($hCombo)
_GUICtrlComboBoxEx_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate($hCombo)
_GUICtrlComboBoxEx_EndUpdate($hCombo)
; Limit Text in Edit control
_GUICtrlComboBoxEx_LimitText($hCombo, 10)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main