找回密码
 加入
搜索
查看: 1291|回复: 1

怎样列出指定目录中的所有EXE

[复制链接]
发表于 2009-9-21 17:09:56 | 显示全部楼层 |阅读模式
本帖最后由 xlcwxl 于 2009-9-21 17:24 编辑

怎样列出指定目录中的所有EXE,并显示在Combo中
发表于 2009-9-24 16:30:33 | 显示全部楼层
本帖最后由 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
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 19:22 , Processed in 0.073309 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表