⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filefinder.h

📁 VC++编程
💻 H
字号:
/*********************************************************************

   Copyright (C) 2000 Smaller Animals Software, Inc.

   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   arising from the use of this software.

   Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:

   1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.

   2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.

   3. This notice may not be removed or altered from any source distribution.

   http://www.smalleranimals.com
   smallest@smalleranimals.com

**********************************************************************/

// FileFinder.h: interface for the CFileFinder class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FILEFINDER_H__43F5DBE6_5341_11D4_937A_0050DABB534C__INCLUDED_)
#define AFX_FILEFINDER_H__43F5DBE6_5341_11D4_937A_0050DABB534C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////
// safe data access for data shared between threads
extern CRITICAL_SECTION g_findFileCritSection;
template <class T> T GET_SAFE( T a ) {EnterCriticalSection(&g_findFileCritSection); T z = a; LeaveCriticalSection(&g_findFileCritSection); return z;}
template <class T> void SET_SAFE( T & a , T b) {EnterCriticalSection(&g_findFileCritSection); a = b; LeaveCriticalSection(&g_findFileCritSection);}

struct searchStruct
{
	searchStruct()
	{
		m_bFindSingleFile = false;	
		m_bRecurse = true;
		m_bCancel = false;
		
		m_bSearchNetworkDrives = false;
		m_bSearchRemovableDrives = false;
		m_bSearchCDROMDrives = false;

		m_bOk = true;
		m_bDone = false;
	}

	// set by caller
	CString	m_csFindFile;
	CString	m_csRootFolder;		
	bool	m_bFindSingleFile;	
	bool	m_bRecurse;
	bool	m_bCancel;
	bool	m_bSearchNetworkDrives;
	bool	m_bSearchRemovableDrives;
	bool	m_bSearchCDROMDrives;

	// set by callee
	CStringArray	m_csaFoundFiles;
	bool	m_bOk;
	bool	m_bDone;

	CString	m_csCurFolder;
	CString m_csCurOperation;

};


class CFileFinder  
{
public:
	CFileFinder(searchStruct *pss);
	virtual ~CFileFinder();

	bool	FindFile();

protected:
	bool	GetSubDirs(CStringArray &dir_array, CString path);

	bool	GetLocalDriveRoots(CStringArray &csaDrives);

	bool	FindFileInFolder(const CStringArray &csaSearchFolders);

	searchStruct *m_pss;
};

#endif // !defined(AFX_FILEFINDER_H__43F5DBE6_5341_11D4_937A_0050DABB534C__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -