StrRetToBuf() and searching file system

This is a discussion on StrRetToBuf() and searching file system within the Windows Programming forums, part of the Platform Specific Boards category; I've been screwing around for the past few days trying to search through the file system to find all files ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    3

    Question StrRetToBuf() and searching file system

    I've been screwing around for the past few days trying to search through the file system to find all files of a certain type (*.mp3 in my case). Using a bunch of Shell functions I've managed to recursively move through folders and search files...it's pretty nasty but it (almost) works. First, is there a better way to be doing this?

    Second, I say it almost works because I'm trying to use the Shell API function StrRetToBuf() and Visual Studio keeps telling me it is not a defined function. I think I have all the proper libraries included and linked: (shlobj.h, shlwapi.h, shtypes.h). Anyone have any idea why I'm getting this error?

    C:\Program Files\Microsoft Visual Studio\MyProjects\testIShell\main.cpp(36) : error C2065: 'StrRetToBuf' : undeclared identifier

    Thanks!

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Have you tried FindFirstFile() FindNextFile() ect under Windows (using *.mp3)
    Don't forgat the FindClose()

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    For StrRetToBuf() you need shlwapi.h and will have to link shlwapi.lib. But you should used use the technique novacain described.

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    3
    I've already included shlwapi.h and I'm linking shwapi.lib...this is all MSDN says is required to get it to work but still I get a compilation error.

    I am already using FindFirstFile() but that will only search the current directory and not any sub-folders. So I'm using the shell interface to recurse through each sub-folder and then use FindFirstFile().

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I think if the OP was still waiting for an answer to a post this old, he'd deserve a medal.

    Closed.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21