|
-
Jun 11th, 2002, 06:50 AM
#1
Thread Starter
Lively Member
Playlist
-I have also made a playlist to the player. But I am only able to add one file at a time... This takes very long time when you have got 500+ files!
-Does anyone know how to browse/open an entire directory in a playlist, and/or how to browse/add all the files at once?!
-
Jun 11th, 2002, 07:01 AM
#2
-= B u g S l a y e r =-
are you using the common dialog control?
if so, you can use multiselect in order for the user to select more than one file at the time.
VB Code:
Private Sub Command1_Click()
Dim sArr() As String
Dim i As Integer
CommonDialog1.Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
CommonDialog1.ShowOpen
sArr = Split(CommonDialog1.FileName, Chr(0))
For i = 0 To UBound(sArr())
Debug.Print sArr(i)
Next i
End Sub
-
Jun 11th, 2002, 07:03 AM
#3
-= B u g S l a y e r =-
if you want the user to be able to browse for a folder, this is how:
VB Code:
Option Explicit
Public Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Public Const BIF_RETURNONLYFSDIRS = 1
Public Const BIF_NEWDIALOGSTYLE = &H40
Public Const MAX_PATH = 260
Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Public Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Public Function BrowseForFolder(hwndOwner As Long, sPrompt As String) As String
'declare variables to be used
Dim iNull As Integer
Dim lpIDList As Long
Dim lResult As Long
Dim sPath As String
Dim udtBI As BrowseInfo
'initialise variables
With udtBI
.hwndOwner = hwndOwner
.lpszTitle = lstrcat(sPrompt, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
End With
'Call the browse for folder API
lpIDList = SHBrowseForFolder(udtBI)
'get the resulting string path
If lpIDList Then
sPath = String$(MAX_PATH, 0)
lResult = SHGetPathFromIDList(lpIDList, sPath)
Call CoTaskMemFree(lpIDList)
iNull = InStr(sPath, vbNullChar)
If iNull Then sPath = Left$(sPath, iNull - 1)
End If
'If cancel was pressed, sPath = ""
BrowseForFolder = sPath
End Function
'usage :
Private Sub Form_Click()
MsgBox BrowseForFolder(Me.hWnd, "select folder")
End Sub
now all you have to do is make a routine to list all the files in the
selected folder mathcing .mp3 to the playlist
-
Jun 11th, 2002, 10:50 AM
#4
Thread Starter
Lively Member
-
Jun 11th, 2002, 10:58 AM
#5
-= B u g S l a y e r =-
hehe alt for en nordmann 
hvor i norge er du fra ?
-
Jun 11th, 2002, 11:10 AM
#6
Thread Starter
Lively Member
-
Jun 11th, 2002, 11:19 AM
#7
-= B u g S l a y e r =-
hehe vet hvor bodø er, aldri vært der.
vi får fortsette på engelsk, så de andre ikke blir snurt 
This will make it possible for the user to select more than one file
using standard procedure (Ctrl + Click or Shift + Click when selecting files.)
VB Code:
Private Sub Command1_Click()
Dim sArr() As String
Dim i As Integer
On Error Resume Next
cd1.Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
cd1.Filter = "Music(*.mp3;*.wav)|*.mp3;*.wav"
cd1.ShowOpen
If cd1.FileName = "" Then Exit Sub
sArr = Split(cd1.FileName, Chr(0))
For i = 1 To UBound(sArr())
lstfavs.AddItem sArr(i)
Next i
cd1.FileName = ""
End Sub
-
Jun 11th, 2002, 11:24 AM
#8
Thread Starter
Lively Member
-Wow! You sure know programming!
-I hope you don`t mind I put you on my buddy list - It could be nice to know an expert!
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
|