CB_GETLBTEXTLEN (Constants)
Last changed: 212.44.26.236

.
Summary
TODO - a short description of this collection of constants

VB Constants:

    Private Const CB_GETLBTEXT = &H148
    Private Const CB_GETLBTEXTLEN = &H149

Notes:

Use this method to get the list of items out of a combo box using Windows API call (SendMessage). You need to

get the count of items in the combo box first (also with SendMessage api).

''' <summary>
    ''' Created by Allen Forrester (forrester72a@gmail.com)
    ''' </summary>
    ''' <param name="windowHandle">Window handle of combo box</param>
    ''' <returns>List of items within combo box.</returns>
    ''' <remarks></remarks>
    Public Function GetComboBoxList(ByValwerwerwe windowHandle As Integer) As List(Of String)
    Try
        ' List for return
        Dim cBoxList As New List(Of String)
        ' stringbuilder for converting value to text
        Dim winText As New StringBuilder()
        ' get count of combobox
        Dim lCount As Integer = GetComboBoxCount(windowHandle)
        ' if count is 0, return new list of nothing
        If lCount = 0 Then Return New List(Of String)
        ' loop through items in combobox
        For i As Integer = 0 To lCount - 1
        ' index obj
        Dim iPtr As New IntPtr(i)
        ' pointer
        Dim zero As New IntPtr(0)
        ' length of string
        Dim ptrLength As Integer = SendMessage(windowHandle, ComboBox_GetComboBoxTextLength, iPtr, zero)
        ' string builder to send
        winText = New StringBuilder(ptrLength + 1)
        ' call api
        SendMessage(windowHandle, ComboBox_GetComboBoxText, iPtr, winText)
        ' convert it to text
        cBoxList.Add(winText.ToString)
        Next

        Return cBoxList

    Catch
        Return New List(Of String)
    End Try
    End Function

None.