|
-
Jul 21st, 2010, 05:59 PM
#11
Re: Having trouble with Listbox
I'd suggest Inet. Goto Components | Controls and check: Microsoft Internet Transfer Control
Add the control to a form and add some code:
vb Code:
Dim strDirs As String
strDirs = Inet1.OpenURL(YOUR_URL_HERE)
Most likely your server will return a list of links. You can use StrFindBetween, for instance, see the link in my sig under Strings. You'll want to find: "<a href=""" to """>", then perform an Instr on the string between those two strings. In the Instr determine if there's a forward slash "/", and if so treat that as a directory, and not a file. If it's a file(and not a directory), then instr for the ".MP3" extension, and if so add it to the list.
Now, add a List1, and try this:
vb Code:
Dim strDirs As String, strResult As String
Dim X As Long, Y As Long
strDirs = Inet1.OpenURL("some_url_here")
X = InStr(strDirs, "<a href=""")
Do While X > 0
X = X + Len("<a href=""")
Y = InStr(X, strDirs, """>")
If X And Y Then
strResult = LCase$(Mid$(strDirs, X, Y - X))
If InStr(strResult, "/") Then
'directory
ElseIf InStr(strResult, ".mp3") Then
'mp3 file
List1.AddItem Mid$(strDirs, X, Y - X) 'names are case sensitive, so re-fetch this
Else
'other file
End If
Else
Exit Do 'we're out of string, there are no matches
End If
X = InStr(Y, strDirs, "<a href=""")
Loop
Last edited by FireXtol; Jul 21st, 2010 at 06:15 PM.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|