Download Source Code

CFindFiles Class Reference

Simple wrapper for the Windows Find Files API. More...

#include <FindFiles.h>

List of all members.

Public Member Functions

void Destroy ()
 Releases all resources used by this class instance.
BOOL BuildPaths ()
 Builds paths to current file.
BOOL FindNext ()
 Finds the next matching file.
BOOL FindFirst (LPCTSTR pDir, LPCTSTR pMask="*.*")
 Finds the first matching file.
 CFindFiles ()
 Constructor.
 CFindFiles (LPCTSTR pDir, LPCTSTR pMask="*.*")
 Construcs object and finds the first matching file.
virtual ~CFindFiles ()
 Destructor.
LPCTSTR GetPath ()
 Returns the path to the found file.
LPCTSTR GetFullPath ()
 Returns the complete filename for the found file.
LPCTSTR GetFileName ()
 Returns the filename for the current matching file.
DWORD GetFileAttributes ()
 Returns the file attributes of the current matching file.
BOOL IsDirectory ()
 Returns non-zero if the current match is a directory.
 operator WIN32_FIND_DATA * ()
 Returns pointer to WIN32_FIND_DATA structure.
WIN32_FIND_DATA * Wfd ()
 Returns pointer to WIN32_FIND_DATA structure.

Static Public Member Functions

static BOOL IsDirectory (LPCTSTR pDir)
 Returns non-zero if the specified path is a directory.


Detailed Description

Simple wrapper for the Windows Find Files API.

Use this class to search for files and directories.

To search sub-folders as well, use TRecursiveFindFiles.

Typical example:

    CFindFiles ff;

    if ( ff.FindFirst( "C:\\", "*.*" ) )
        do
        {

            if ( ff.IsDirectory() ) ; // Use folder

            else ; // Use file

        } while ( ff.FindNext() );


Constructor & Destructor Documentation

CFindFiles::CFindFiles LPCTSTR  pDir,
LPCTSTR  pMask = "*.*"
 

Construcs object and finds the first matching file.

Parameters:
[in] pDir - Directory to start search
[in] pMask - File search mask
Returns:
Non-zero if a matching file was found
See also:


Member Function Documentation

BOOL CFindFiles::BuildPaths  ) 
 

Builds paths to current file.

Returns:
Non-zero if success

BOOL CFindFiles::FindFirst LPCTSTR  pDir,
LPCTSTR  pMask = "*.*"
 

Finds the first matching file.

Parameters:
[in] pDir - Directory to start search
[in] pMask - File search mask
Returns:
Non-zero if a matching file was found
See also:

BOOL CFindFiles::FindNext  ) 
 

Finds the next matching file.

Returns:
Non-zero if another file is found

static BOOL CFindFiles::IsDirectory LPCTSTR  pDir  )  [inline, static]
 

Returns non-zero if the specified path is a directory.

Parameters:
[in] pDir - Directory path
Returns:
Non-zero if the specified path is a directory
See also:


The documentation for this class was generated from the following files:
  • inc/FindFiles.h
  • FindFiles.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL