VB Code:
lstUser.AddItem 45
lstUser.AddItem 43
lstUser.AddItem 12
lstComp.AddItem 12
lstComp.AddItem 41
lstComp.AddItem 27
lstComp.AddItem 29
lstComp.AddItem 5
Dim lngRetVal As Long
Dim intWins As Integer
Dim intIndex As Integer
Dim strPrize As String
For intIndex = 0 To lstUser.ListCount - 1
lngRetVal = SendMessageString(lstComp.hwnd, _
LB_FINDSTRING, -1&, _
lstUser.List(intIndex))
' lngRetVal is the ListIndex
If lngRetVal > -1& Then
intWins = intWins + 1
End If
Next
If intWins = 1 Then
strPrize = " prize."
Else
strPrize = " prizes."
End If
MsgBox "There was " & intWins & " match: you have won " & intWins & strPrize