Function Reference

_GUICtrlComboBox_GetList

コンボボックスコントロールのリスト部分から全てのアイテムを取得します。

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetList($hWnd)

 

パラメータ

$hWnd コントロールのハンドル

 

返し値

成功: 全コンボボックスアイテムを含む区切られた文字列

 

注意

デフォルトの区切り文字は"|"です。これはOpt("GUIDataSeparatorChar", "新しい区切り文字")を使用して変更することができます。

 

関連

_GUICtrlComboBox_GetListArray

 


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; ComboBox/ComboBoxEx関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用

Global $iMemo

_Main()

Func _Main()
    Local $aList, $hCombo
    Opt("GUIDataSeparatorChar", ",") ; 区切り文字を使用したい文字に設定

    ; GUIを作成
    GUICreate("ComboBox Get List", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

    ; ファイルを追加
    _GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)

    ; リストを取得
    $aList = StringSplit(_GUICtrlComboBox_GetList($hCombo), ",")
    For $x = 1 To $aList[0]
        MemoWrite($aList[$x])
    Next

    ; ユーザーが終了するまでループ
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

; メモコントロールに1行書き込み
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite