Ok, I have a list box. How do I show all files on d:\ or e:\ drives and when one is selected, use PlaySound() to play the selected file? I need a short code. I am new to all the list boxes and all that.
Ok, I have a list box. How do I show all files on d:\ or e:\ drives and when one is selected, use PlaySound() to play the selected file? I need a short code. I am new to all the list boxes and all that.
For WIN32 API
Process the WM_NOTIFY in your dialog/windows callback.
LView = (NM_LISTVIEW FAR *) lParam;
if(LVN_ITEMCHANGED==LView->hdr.code)
{
if(LView->uNewState==3)//find the selected item (three is the newstate==selected)
{
Location=LView->iItem;
if(LastLocation!=Location)//Location chosen is different from last one
LastLocation=Location;
//now play the sound
You will need to set up columns and titles. Look through the previous posts for some code to do this.
Don't forget to InitCommonControls().
Use FindFirstFile and FindNextFile to get the files.