The following code demonstrates how to enumerate and select ltmmCaptureCtrl inputs:
Sub EnumerateInputs(Inputs As ltmmCaptureInputs, List As ListBox)
' Build the inputs list box
Dim Selected As Long
Selected = -1
List.Clear
For i = 0 To (Inputs.Count - 1)
List.AddItem Inputs.Item (i).Name
List.ItemData(List.NewIndex) = i
If Inputs.Item (i).Selected Then
Selected = i
End If
Next
' highlight the current selection
For i = 0 To (List.ListCount - 1)
If List.ItemData(i) = Selected Then
List.Selected(i) = True
End If
Next
End Sub
Sub SelectInput(Inputs As ltmmCaptureInputs, List As ListBox)
' select the highlighted input
Inputs.Selection = List.ItemData(List.ListIndex)
End Sub
Sub SelectInputName(Inputs As ltmmCaptureInputs, List As ListBox, Name As String)
Dim Index As Long
' select the input by name
Index = Inputs.Find (Name)
If Index >= 0 Then
Inputs.Selection = Index
' highlight the match
For i = 0 To (List.ListCount - 1)
If List.ItemData(i) = Index Then
List.Selected(i) = True
End If
Next
End If
End Sub
Private Sub cmdCompositeVideo_Click()
SelectInputName ltmmCaptureCtrl1.VideoInputs, lstVideoInputs, "Video Composite"
End Sub
Private Sub Form_Load()
' select the first video capture device
ltmmCaptureCtrl1.VideoDevices.Selection = 0
' build the video input list
EnumerateInputs ltmmCaptureCtrl1.VideoInputs, lstVideoInputs
End Sub
Private Sub lstVideoInputs_Click()
' select the video input
SelectInput ltmmCaptureCtrl1.VideoInputs, lstVideoInputs
End Sub