Function Reference

_GUICtrlComboBox_GetLBText

コンボボックスのリストから文字列を取得します。

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLBText($hWnd, $iIndex, ByRef $sText)

 

パラメータ

$hWnd コントロールのハンドル
$iIndex 取得するもののゼロ始まりのインデックス
$sText 文字列を受け取る変数

 

返し値

成功: 文字列の長さ
失敗: -1

 

注意

なし。

 

関連

_GUICtrlComboBox_GetLBTextLen

 


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

Opt('MustDeclareVars', 1)

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

_Main()

Func _Main()
    Local $sText, $iLen, $hCombo

    ; GUIを作成
    GUICreate("ComboBox Get LB Text", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    GUISetState()

    ; ファイルを追加
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)
   
    ; LBのテキストを取得
    $iLen = _GUICtrlComboBox_GetLBText($hCombo, 2, $sText)
    MsgBox(4160, "Information", "LB Text: " & $sText)

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