www.pudn.com > SMS.rar > HwDir.h
// HwDir.h: interface for the CHwDir class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_HWDIR_H__34BBAAEE_8BD0_4715_BB06_7BC3A7A4C315__INCLUDED_) #define AFX_HWDIR_H__34BBAAEE_8BD0_4715_BB06_7BC3A7A4C315__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include#include "..\..\global.h" class DLL_INTERNAL CHwDir { public: CHwDir(LPCTSTR lpszBasePathOrFile,BOOL bSerachSubDir = TRUE,BOOL bAbsolutePath = TRUE); virtual ~CHwDir(); public: ULONGLONG GetAmountBytes(); CStringArray *m_pStrAryResFile, *m_pStrArySubDirectory; TCHAR m_szBasePathFile[MAX_PATH]; private: DWORD FindAllFileUnderOneDir(LPCTSTR lpszFileName,LPCTSTR lpszDirectory,BOOL bFindDir); DWORD Dir(); int HandleOneFile(LPCTSTR lpszDirectory, WIN32_FIND_DATA* pFindData,BOOL bFindDir); DWORD FindDirAndFile(LPCTSTR lpszDirectory); private: CStringArray *m_pStrArySubDirectory_Private; DWORD m_dwDirNum; ULONGLONG m_AmountBytes; BOOL m_bSerachSubDir; BOOL m_bAbsolutePath; //是否要保存绝对路径 DWORD m_dwRelativePathStartPos; //相对路径的起始位置 TCHAR m_strFilter[MAX_PATH/2]; }; class DLL_INTERNAL CHwDirEx { public: CHwDirEx( LPCTSTR lpszMultiFindPath, // 要搜索的路径,如“E:\\winnt\\;d:\temp\\;” LPCTSTR lpszMultiFindFilter, // 要搜索的过滤条件,如“*.bmp;*.exe;” LPCTSTR lpszMultiExcludeFilter=NULL, // 要排除的过滤条件,如“*.bmp;*.exe;” BOOL bSerachSubDir = TRUE, // 搜索子目录 BOOL bAbsolutePath =TRUE // 是绝对路径 ); ULONGLONG GetAmountBytes(); virtual ~CHwDirEx(); CStringArray *m_pStrAryResFile, *m_pStrArySubDirectory; private: void DirAll( LPCTSTR lpszFindPath, // 要搜索的路径,如“E:\\winnt\\” LPCTSTR lpszMultiFindFilter, // 要搜索的过滤条件,如“*.bmp;*.exe;” LPCTSTR lpszMultiExcludeFilter=NULL, // 要排除的过滤条件,如“*.bmp;*.exe;” BOOL bSerachSubDir = TRUE, // 搜索子目录 BOOL bAbsolutePath =TRUE // 是绝对路径 ); void Dir( LPCTSTR lpszFindPath, // 要搜索的路径,如“E:\\winnt\\” LPCTSTR lpszMultiFindFilter, // 要搜索的过滤条件,如“*.bmp;*.exe;” CStringArray &StrAryResFile, // 搜索的文件保存到此 CStringArray &StrArySubDirectory, // 搜索的子目录保存到此 DWORD &dwAmountBytes, // 总字节数保存到此 BOOL bSerachSubDir = TRUE, // 搜索子目录 BOOL bAbsolutePath =TRUE // 是绝对路径 ); DWORD m_dwDirNum; ULONGLONG m_AmountBytes; }; #endif // !defined(AFX_HWDIR_H__34BBAAEE_8BD0_4715_BB06_7BC3A7A4C315__INCLUDED_)