Hi,

For the purpose of creating a very simple mp3 player i would like to have a listview that allows a user to click on a listed file and play an audio file.
I figure that to solve this the program should display the contents of a directory containing the music files in listview.

Please could somebody explain very simply how to populate listview with the contents of a directory? I also realise that maybe listview may not be appropriate for this, if so what should i use.

p.s Im working with XP and visual studio 2005.

I have done something similar to this in c#, but have never translated to c++ although the process should be similar. Depending on what API you are using, you want to look wherever your music is, and loop through all the files in the directory, adding a string containing your files path to your list view as you go. Then using some audio playback functionality included with your API, grab the string of the file location from your listview depending on where you click and tell your program to open the audio file.

if you use wxWidgets there is wxListCtrl class!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.