Thread: Problem with file listbox

  1. #1
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584

    Problem with file listbox

    I am looking to filter out all file types from the listbox (send the LB_DIR message) but "*.html". I set this as one of the params of SendMessage, but when I ran the program, it also filtered out all of the dirs so I couldn't "go through" the hdd. How could I use this *.html filter but also have the directory folders still show up? Thanks...

    Garfield
    1978 Silver Anniversary Corvette

  2. #2
    Maybe there is a way to do it with LB_DIR.
    But I've always done it with FindFirstFile and FindNextFile.
    You can put them in a linked list and then add them to the listbox.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Garf, if you want an open file dialog, then use the custom windows one. There's nothing to be gained from reinveting the wheel

    Go to MSDN and look up GetOpenFileName().

    Its a bit of a mare to configure, but when it's right it works like a dream

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    >> There's nothing to be gained from reinveting the wheel <<

    Yes, that's true...

    Garfield
    1978 Silver Anniversary Corvette

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You could add everything and then at the end remove the ones that are not folders or .html files.

    Use SendMessage() with LB_GETITEMTEXT and ListView_GetItemCount()
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Originally posted by novacain
    You could add everything and then at the end remove the ones that are not folders or .html files.

    Use SendMessage() with LB_GETITEMTEXT and ListView_GetItemCount()
    Yes, I might have to do this.
    1978 Silver Anniversary Corvette

  7. #7
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Really garf...It's much simpler, and much nicer on your user to use GetOpenFilename()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. read from file problem
    By Martin Kovac in forum C Programming
    Replies: 1
    Last Post: 04-13-2009, 08:33 AM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Subtle(?) File I/O Problem
    By cecomp64 in forum C Programming
    Replies: 9
    Last Post: 07-16-2008, 11:39 AM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM