本帖最后由 wisly 于 2009-9-24 16:59 编辑
参考帮助文档改的代码:#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>
Global $Directory, $search, $Filelist[1]
$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work
$Directory = InputBox ("Input", "Please enter the directory")
$search = FileFindFirstFile($Directory&"\*.exe")
$Filelist[0]=0
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$Filelist[0] += 1
ReDim $Filelist[$Filelist[0]+1]
$Filelist[$Filelist[0]]=$file
WEnd
FileClose ($search)
_Main()
Func _Main()
Local $hCombo
; Create GUI
GUICreate("ComboBox Add String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()
; Add string
For $i = 1 to $Filelist[0]
_GUICtrlComboBox_AddString($hCombo, $Filelist[$i])
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
|