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

📄 filefind.cpp

📁 一个国人自己实现图像库的程序(有参考价值)
💻 CPP
字号:
#include "stdafx.h"
#include "..\Include\FileFind.h"

//===================================================================
BOOL  FCFileFind::FindFile (PCTSTR szPathName)
{
	if (m_hFileFind != INVALID_HANDLE_VALUE)
		this->FindClose () ;

	WIN32_FIND_DATA		FileData ;
	m_hFileFind = ::FindFirstFile (szPathName, &FileData) ;
	if (m_hFileFind == INVALID_HANDLE_VALUE)
		return FALSE ;

	TCHAR	szDir[_MAX_DIR] ;
	_splitpath (szPathName, m_szFindPath, szDir, NULL, NULL) ;
	lstrcat (m_szFindPath, szDir) ; // 获得查找路径

	//	目录 "." & ".."
	if (!lstrcmp (TEXT("."), FileData.cFileName) || !lstrcmp (TEXT(".."), FileData.cFileName))
		return this->FindNext () ;	// Skip . and ..

	m_dwFileAttribute = FileData.dwFileAttributes ;
	m_dwFileSize = (m_dwFileAttribute == FILE_ATTRIBUTE_DIRECTORY) ? -1 : FileData.nFileSizeLow ;
	lstrcpy (m_szFullName, m_szFindPath) ;
	lstrcat (m_szFullName, FileData.cFileName) ;
	return TRUE ;
}
//===================================================================
BOOL  FCFileFind::FindNext ( )
{
	if (m_hFileFind == INVALID_HANDLE_VALUE)
		return FALSE ;

	WIN32_FIND_DATA		FileData ;
	if (::FindNextFile (m_hFileFind, &FileData) == 0)
	{
		this->FindClose () ;
		return FALSE ;
	}

	//	目录 "." & ".."
	if (!lstrcmp (TEXT("."), FileData.cFileName) || !lstrcmp (TEXT(".."), FileData.cFileName))
		return this->FindNext () ;	// Skip . and ..

	m_dwFileAttribute = FileData.dwFileAttributes ;
	m_dwFileSize = (m_dwFileAttribute == FILE_ATTRIBUTE_DIRECTORY) ? -1 : FileData.nFileSizeLow ;
	lstrcpy (m_szFullName, m_szFindPath) ;
	lstrcat (m_szFullName, FileData.cFileName) ;
	return TRUE ;
}
//===================================================================

⌨️ 快捷键说明

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