Windows Media Player Library Search - Wild Card?
Hi guys.
im using a media player control to access WMP library
I need to search the library, for song title, artist and album.
all going well so far, as long as i get a dead on match...
is there any way to make it find a close match - such as that in media player itself... [ie: Rock will find Rock Ferry, Rock a by baby, ETC]
i have tried the % and * wild cards, but doesnt help. CHEERS!
i have 3 option selects [name, artist, album], 1 command button, and the wmp on my form.... and...
Ive got the following code:
vbcode Code:
Dim CurSong As IWMPMedia
Dim medcol As IWMPPlaylist
Dim iSearch As Integer
Private Sub cmdSearch_Click()
Dim sSearch As String: sSearch = InputBox("Enter term to search:")
Select Case iSearch
Case 0:
Set medcol = wmp.mediaCollection.getByName(sSearch)
Case 1:
Set medcol = wmp.mediaCollection.getByAuthor(sSearch)
Case 2:
Set medcol = wmp.mediaCollection.getByAlbum(sSearch)
End Select
Debug.Print medcol.Count
Dim i As Integer
Dim sFilepath As String, iMediaCount As Integer
iMediaCount = 0
For i = 0 To medcol.Count - 1
sFilepath = medcol.Item(CLng(i)).sourceURL
If Right$(sFilepath, 4) <> ".wpl" Then
Debug.Print i & " - " & medcol.Item(CLng(i)).Name & ": " & sFilepath
iMediaCount = iMediaCount + 1
' play the last song found...
If i = medcol.Count - 1 Then
Set CurSong = wmp.newMedia(sFilepath)
wmp.currentMedia = CurSong
End If
Else
Debug.Print i & "..."
End If
DoEvents
Next i
Debug.Print "Useful media files:" & iMediaCount
End Sub
Private Sub optSearch_Click(Index As Integer)
iSearch = Index
End Sub