当前位置: 首页>>代码示例>>C++>>正文


C++ CFindFile::FindNextFile方法代码示例

本文整理汇总了C++中CFindFile::FindNextFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFindFile::FindNextFile方法的具体用法?C++ CFindFile::FindNextFile怎么用?C++ CFindFile::FindNextFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFindFile的用法示例。


在下文中一共展示了CFindFile::FindNextFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DeleteFolder

void DeleteFolder(CString dir)
{
	if(FileIsDirectory(dir))
	{
		//SHFILEOPSTRUCT   Op;
		//ZeroMemory(&Op,   sizeof(Op));   //删除文件夹
		//Op.hwnd   =   NULL; 
		//Op.wFunc   =   FO_DELETE;
		//Op.pFrom   =   dir;
		//Op.fFlags   =   FOF_ALLOWUNDO   |   FOF_NOCONFIRMATION;     
		//SHFileOperation(&Op);

		CFindFile   tempFind;
		CString   tempFileFind;
		tempFileFind.Format(_T("%s\\*.*"),dir);
		BOOL   IsFinded   =   tempFind.FindFile(tempFileFind);
		while   (IsFinded)
		{
			IsFinded   =   tempFind.FindNextFile();
			if(!tempFind.IsDots())
			{
				if(tempFind.IsDirectory())
					DeleteFolder(tempFind.GetFilePath());
				else
					DeleteFile(tempFind.GetFilePath());
			}
		}
		tempFind.Close();
		RemoveDirectory(dir);
	}
}
开发者ID:william0wang,项目名称:meditor,代码行数:31,代码来源:shared.cpp

示例2: EnumAllFiles

bool CClientApp::EnumAllFiles(string sFolder)
{
	if ( sFolder.length() == 0 )
		return false;

	bool bRet = false;
	CFindFile fFind;
	string sFindStr = sFolder + "\\*.*";
	BOOL bFind = fFind.FindFile( sFindStr.c_str() );
	while ( bFind )
	{
		bRet = true;

		if ( fFind.IsDirectory() )
		{
			if ( !fFind.IsDots() )
			{
				if ( !EnumAllFiles( fFind.GetFilePath().GetBuffer(0) ) )
				{
					bRet = false;
					break;
				}
			}
		}
		else
		{
			CMediaFile* pMediaFile = new CMediaFile();
			if ( pMediaFile )
			{
				if ( pMediaFile->InitFile( fFind.GetFilePath().GetBuffer(0), fFind.GetFileName().GetBuffer(0) ) )
				{
					pMediaFile->m_sNodeName = "Kevin_Test_Node_Name";
					m_MediaFileMgr.Insert( pMediaFile->m_sFileHash, pMediaFile );
					// 查找到立即发布
					PublishFiles();
				}
				else
				{
					delete pMediaFile;
					CKLog::WriteLog( LOG_TYPE_DEBUG, "%s InitFile Failed.", fFind.GetFilePath() );
					WriteLog( LOG_TYPE_DEBUG, "%s InitFile Failed.", fFind.GetFilePath() );
				}
			}
		}

		bFind = fFind.FindNextFile();
	}
	fFind.Close();

	return bRet;
}
开发者ID:340211173,项目名称:P2PCenter,代码行数:51,代码来源:ClientApp.cpp

示例3: ConvertPath

//=============================================================================
// 函数名称:	移动覆盖一个指定的目录
// 作者说明:	mushuai
// 修改时间:	2013-03-14
//=============================================================================
int ConvertPath(LPCTSTR srcpath,LPCTSTR targpath)
{
	int iresult = 1;
	CFindFile finder;
	if(finder.FindFile(srcpath))
	{
		CString fileName,filePath;
		do
		{
			fileName=finder.GetFileName();
			filePath = finder.GetFilePath();
			//. ..
			if (finder.IsDots())
			{
				continue;
			}
			//dir
			else if (finder.IsDirectory())
			{
				CString tTargPath = targpath;
				tTargPath +=_T("\\")+fileName;
				ConvertPath(filePath+_T("\\*"),tTargPath);
				RemoveDirectory(filePath);
			}
			else//file
			{
				CString newFilePath = targpath;
				newFilePath +=_T("\\")+fileName;					
				if (!PathFileExists(targpath))
				{
					if(ERROR_SUCCESS != SHCreateDirectoryEx(0,targpath,0))
					{
						return 0;
					}
				}
				BOOL res=MoveFileEx(filePath,newFilePath,MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
				if (!res)
				{
					SetFileAttributes(newFilePath,FILE_ATTRIBUTE_NORMAL);
					if (!DeleteFile(newFilePath))
					{
						MoveFileEx(filePath,newFilePath,MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
					}
				}
			}
		}while (finder.FindNextFile());
	}
	finder.Close();
	return iresult;
}
开发者ID:ChenzhenqingCC,项目名称:WinProjects,代码行数:55,代码来源:publicfun.cpp

示例4: _PopulateList

int CPhotoEngine::_PopulateList(LPCTSTR szPath)
{
	const int count = 0;
	BOOL bRes;
	CFindFile ff;
	CString sPattern;
	sPattern.Format(_T("%s\\*.jpg"), szPath);
	for( bRes = ff.FindFile(sPattern); bRes; bRes = ff.FindNextFile() )
	{
		if( ff.IsDirectory() ) continue;
		AddImageFile(ff.GetFilePath(), ff.GetFileName());
	}

	return 0;
}
开发者ID:ayang,项目名称:leafanalysis,代码行数:15,代码来源:PhotoEngine.cpp

示例5: UtilPathExpandWild

bool UtilPathExpandWild(std::list<CString> &r_outList,const CString &r_inParam)
{
	std::list<CString> tempList;
	if(-1==r_inParam.FindOneOf(_T("*?"))){	//ワイルド展開可能な文字はない
		tempList.push_back(r_inParam);
	}else{
		//ワイルド展開
		CFindFile cFindFile;
		BOOL bContinue=cFindFile.FindFile(r_inParam);
		while(bContinue){
			if(!cFindFile.IsDots()){
				tempList.push_back(cFindFile.GetFilePath());
			}
			bContinue=cFindFile.FindNextFile();
		}
	}
	r_outList=tempList;
	return true;
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:19,代码来源:FileOperation.cpp

示例6: UtilRecursiveEnumFile

//フォルダ内ファイル(ディレクトリは除く)を再帰検索
bool UtilRecursiveEnumFile(LPCTSTR lpszRoot,std::list<CString> &rFileList)
{
	CFindFile cFindFile;
	TCHAR szPath[_MAX_PATH+1];
	_tcsncpy_s(szPath,lpszRoot,_MAX_PATH);
	PathAppend(szPath,_T("*"));

	BOOL bContinue=cFindFile.FindFile(szPath);
	while(bContinue){
		if(!cFindFile.IsDots()){
			if(cFindFile.IsDirectory()){
				UtilRecursiveEnumFile(cFindFile.GetFilePath(),rFileList);
			}else{
				rFileList.push_back(cFindFile.GetFilePath());
			}
		}
		bContinue=cFindFile.FindNextFile();
	}

	return !rFileList.empty();
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:22,代码来源:FileOperation.cpp

示例7: MenuCommand_MakeSendToCommands

void MenuCommand_MakeSendToCommands()
{
	TCHAR szSendTo[_MAX_PATH];
	std::vector<CString> files;
	if(SHGetSpecialFolderPath(NULL,szSendTo,CSIDL_SENDTO,FALSE)){
		PathAddBackslash(szSendTo);
		PathAppend(szSendTo,_T("*.lnk"));
		CFindFile cFind;

		BOOL bFound=cFind.FindFile(szSendTo);
		for(;bFound;bFound=cFind.FindNextFile()){
			if(cFind.IsDots())continue;

			if(!cFind.IsDirectory()){	//サブディレクトリ検索はしない
				files.push_back(cFind.GetFilePath());
			}
		}
	}

	UtilGetShortcutInfo(files,s_SendToCmd);
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:21,代码来源:MenuCommand.cpp

示例8: Init

int CCrashInfoReader::Init(LPCTSTR szFileMappingName)
{ 
	// This method unpacks crash information from a shared memory (file-mapping)
	// and inits the internal variables.

	strconv_t strconv;
    CErrorReportInfo eri;

	// Init shared memory
	if(!m_SharedMem.IsInitialized())
	{
		// Init shared memory
		BOOL bInitMem = m_SharedMem.Init(szFileMappingName, TRUE, 0);
		if(!bInitMem)
		{
			m_sErrorMsg = _T("Error initializing shared memory.");
			return 1;
		}
	}

	// Unpack crash description from shared memory
    m_pCrashDesc = (CRASH_DESCRIPTION*)m_SharedMem.CreateView(0, sizeof(CRASH_DESCRIPTION));

    int nUnpack = UnpackCrashDescription(eri);
    if(0!=nUnpack)
    {
		m_sErrorMsg = _T("Error unpacking crash description.");
        return 2;
    }
	
	// Create LOCAL_APP_DATA\UnsentCrashReports folder (if doesn't exist yet).
    BOOL bCreateFolder = Utility::CreateFolder(m_sUnsentCrashReportsFolder);
    if(!bCreateFolder)
        return 3;

	// Save path to INI file storing settings
    m_sINIFile = m_sUnsentCrashReportsFolder + _T("\\~CrashRpt.ini");          

    if(!m_bSendRecentReports) // We should send report immediately
    { 
        CollectMiscCrashInfo(eri);

        eri.m_sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + eri.m_sCrashGUID;
        Utility::CreateFolder(eri.m_sErrorReportDirName);		

        m_Reports.push_back(eri);
    }  
    else // We should look for pending error reports
    {
        // Unblock the parent process
        CString sEventName;
        sEventName.Format(_T("Local\\CrashRptEvent_%s"), eri.m_sCrashGUID);
        HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, sEventName);
        if(hEvent!=NULL)
            SetEvent(hEvent);

        // Look for pending error reports and add them to the list
        CString sSearchPattern = m_sUnsentCrashReportsFolder + _T("\\*");
        CFindFile find;
        BOOL bFound = find.FindFile(sSearchPattern);
        while(bFound)
        {
            if(find.IsDirectory() && !find.IsDots()) // Process directories only
            {
                CString sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + 
                    find.GetFileName();
                CString sFileName = sErrorReportDirName + _T("\\crashrpt.xml");
                CErrorReportInfo eri2;
                eri2.m_sErrorReportDirName = sErrorReportDirName;
				// Read crash description XML from the directory
                if(0==ParseCrashDescription(sFileName, TRUE, eri2))
                {          
					// Calculate crash report size
                    eri2.m_uTotalSize = GetUncompressedReportSize(eri2);
					// Add report to the list
                    m_Reports.push_back(eri2);
                }
            }

            bFound = find.FindNextFile();
        }
    }

	// Done
    return 0;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:86,代码来源:CrashInfoReader.cpp

示例9: Init


//.........这里部分代码省略.........
    if(hSilentMode.FirstChild().ToText()!=NULL)
    {
      const char* szSilentMode = hSilentMode.FirstChild().ToText()->Value();
      if(szSilentMode!=NULL)
        m_bSilentMode = atoi(szSilentMode);
    }      
  }

  {
    m_bSendErrorReport = FALSE;    
    TiXmlHandle hSendErrorReport = hRoot.FirstChild("SendErrorReport");
    if(hSendErrorReport.FirstChild().ToText()!=NULL)
    {
      const char* szSendErrorReport = hSendErrorReport.FirstChild().ToText()->Value();
      if(szSendErrorReport!=NULL)
        m_bSendErrorReport = atoi(szSendErrorReport);     
    }      
  }

  {
    m_bAppRestart = FALSE;    
    TiXmlHandle hAppRestart = hRoot.FirstChild("AppRestart");
    if(hAppRestart.FirstChild().ToText()!=NULL)
    {
      const char* szAppRestart = hAppRestart.FirstChild().ToText()->Value();
      if(szAppRestart!=NULL)
        m_bAppRestart = atoi(szAppRestart);     
    }      
  }

  {    
    TiXmlHandle hRestartCmdLine = hRoot.FirstChild("RestartCmdLine");
    if(hRestartCmdLine.FirstChild().ToText()!=NULL)
    {
      const char* szRestartCmdLine = hRestartCmdLine.FirstChild().ToText()->Value();
      if(szRestartCmdLine!=NULL)
        m_sRestartCmdLine = strconv.utf82t(szRestartCmdLine);     
    }      
  }

  {    
    TiXmlHandle hSmtpProxyServer = hRoot.FirstChild("SmtpProxyServer");
    if(hSmtpProxyServer.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpProxyServer = hSmtpProxyServer.FirstChild().ToText()->Value();
      if(szSmtpProxyServer!=NULL)
        m_sSmtpProxyServer = strconv.utf82t(szSmtpProxyServer);     
    }      
  }

  {    
    m_nSmtpProxyPort = 25;
    TiXmlHandle hSmtpProxyPort = hRoot.FirstChild("SmtpProxyPort");
    if(hSmtpProxyPort.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpProxyPort = hSmtpProxyPort.FirstChild().ToText()->Value();
      if(szSmtpProxyPort!=NULL)
        m_nSmtpProxyPort = atoi(szSmtpProxyPort);     
    }      
  }

  if(!m_bSendRecentReports)
  {    
    // Get the list of files that should be included to report
    ParseFileList(hRoot, eri);

    // Get some info from crashrpt.xml
    CString sXmlName = eri.m_sErrorReportDirName + _T("\\crashrpt.xml");
    ParseCrashDescription(sXmlName, FALSE, eri);    
    
    m_Reports.push_back(eri);
  }  
  else
  {
    // Look for unsent error reports
    CString sSearchPattern = m_sUnsentCrashReportsFolder + _T("\\*");
    CFindFile find;
    BOOL bFound = find.FindFile(sSearchPattern);
    while(bFound)
    {
      if(find.IsDirectory() && !find.IsDots())
      {
        CString sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + 
          find.GetFileName();
        CString sFileName = sErrorReportDirName + _T("\\crashrpt.xml");
        ErrorReportInfo eri;
        eri.m_sErrorReportDirName = sErrorReportDirName;
        if(0==ParseCrashDescription(sFileName, TRUE, eri))
        {          
          eri.m_uTotalSize = GetUncompressedReportSize(eri);
          m_Reports.push_back(eri);
        }
      }

      bFound = find.FindNextFile();
    }
  }
  
  return 0;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:101,代码来源:CrashInfoReader.cpp


注:本文中的CFindFile::FindNextFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。