Thread: Fast answer please!!

  1. #1
    BubbleMan
    Guest

    Question Fast answer please!!

    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.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how would you answer this question?
    By smoking81 in forum Linux Programming
    Replies: 3
    Last Post: 09-08-2008, 03:53 AM
  2. Replies: 4
    Last Post: 10-29-2003, 01:18 PM
  3. getting weird answer when not using ".h"
    By CobraCC in forum C++ Programming
    Replies: 10
    Last Post: 05-07-2003, 06:21 AM
  4. Super fast bilinear interpolation
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 09:35 PM
  5. moving a bitmap, fast and smooth
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 05-31-2002, 06:49 PM