本文整理汇总了C++中CFindFile::FindFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFindFile::FindFile方法的具体用法?C++ CFindFile::FindFile怎么用?C++ CFindFile::FindFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFindFile
的用法示例。
在下文中一共展示了CFindFile::FindFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例10: ShowApplet
BOOL ShowApplet(HWND hWnd, LONG_PTR /*lData*/, LPCTSTR pstrCommand)
{
BOOL bWithFingerMenu = FALSE;
CString szPath;
CString szProgramFilesFolder;
WCHAR szInstallDir[MAX_PATH];
WCHAR szValue[MAX_PATH];
ZeroMemory(szValue, sizeof(szValue));
if (SHGetSpecialFolderPath(NULL, szValue, CSIDL_PROGRAM_FILES, FALSE))
{
szProgramFilesFolder.Format(L"%s", szValue);
}
if (RegistryGetString(HKEY_LOCAL_MACHINE, L"Software\\FingerMenu", L"InstallDir", szInstallDir, MAX_PATH) == S_OK)
{
szPath.Format(L"%s\\FingerMenu.exe", szInstallDir);
}
else
{
szPath = szProgramFilesFolder + L"\\FingerMenu\\FingerMenu.exe";
}
CFindFile finder;
if (finder.FindFile(szPath))
{
bWithFingerMenu = TRUE;
}
dlg1.SetTitle(L"Startup");
dlg1.m_bWithFingerMenu = bWithFingerMenu;
if (bWithFingerMenu)
{
dlg2.SetTitle(L"Menu options");
dlg3.SetTitle(L"Menu exclusions");
dlg7.SetTitle(L"Menu wnd exclusions");
}
dlg5.SetTitle(L"Msgbox options");
dlg6.SetTitle(L"Msgbox exclusions");
dlg8.SetTitle(L"Msgbox wnd exclusions");
dlg4.SetTitle(L"Skins");
dlg4.m_bWithFingerMenu = bWithFingerMenu;
dlgAbout.SetTitle(L"About");
// about box
CString strCredits = "\n\n"
"\tFingerMenu v1.12\n\n"
"\tFingerMsgBox v1.01\n\n"
"\rdeveloped by:\n"
"Francesco Carlucci\n"
"<[email protected]>\n"
"\n\n"
"http://forum.xda-developers.com/\n"
" showthread.php?t=459125\n";
dlgAbout.SetCredits(strCredits);
CPropertySheet sheet;
sheet.AddPage(dlg1);
if (bWithFingerMenu)
{
sheet.AddPage(dlg2);
sheet.AddPage(dlg3);
sheet.AddPage(dlg7);
}
sheet.AddPage(dlg5);
sheet.AddPage(dlg6);
sheet.AddPage(dlg8);
sheet.AddPage(dlg4);
sheet.AddPage(dlgAbout);
sheet.SetActivePage(_ttol(pstrCommand));
if (IDOK == sheet.DoModal(hWnd))
{
ReloadConfiguration();
}
return TRUE;
}