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


C++ CFileFind::GetFileName方法代码示例

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


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

示例1: DelNotNullDir

BOOL zstringEx::DelNotNullDir(char* DirName)
{
	CFileFind tempFind; 
	char tempFileFind[1024] ;

	sprintf(tempFileFind,"%s\\*.*",DirName); 
	BOOL IsFinded = tempFind.FindFile(tempFileFind); 
	while (IsFinded) 
	{ 

	IsFinded = tempFind.FindNextFile(); 

	if (!tempFind.IsDots()) 
	{ 
	char foundFileName[1024]; 
	strcpy(foundFileName,tempFind.GetFileName().GetBuffer(1024)); 

	if (tempFind.IsDirectory()) 
	{ 
	char tempDir[1024]; 
	sprintf(tempDir,"%s\\%s",DirName,foundFileName); 
	this->DelNotNullDir(tempDir); 
	} 
	else 
	{ 
	char tempFileName[1024]; 
	sprintf(tempFileName,"%s\\%s",DirName,foundFileName); 
	DeleteFile(tempFileName); 
	} 
	} 
	} 
	tempFind.Close(); 
	if(!RemoveDirectory(DirName)) 
	{ 
	return FALSE; 
	} 

	return TRUE; 
}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:39,代码来源:zstringEx.cpp

示例2: InsertDriveDir

/******************************************************************************
*	作用:		在指定父节点下插入驱动盘下的所有子项
******************************************************************************/
void CMainFrame::InsertDriveDir(HTREEITEM hParent)
{
    HTREEITEM hChild = m_TreeCtrl.GetChildItem(hParent);
    while(hChild)
    {
        CString strText = m_TreeCtrl.GetItemText(hChild);
        if(strText.Right(1) != L"\\")
            strText += L"\\";
        strText += L"*.*";
        CFileFind file;
        BOOL bContinue = file.FindFile(strText);
        while(bContinue)
        {
            bContinue = file.FindNextFile();
            if(!file.IsDots())
                m_TreeCtrl.InsertItem(file.GetFileName(), hChild);
        }
        InsertDriveDir(hChild);
        hChild = m_TreeCtrl.GetNextItem(hChild, TVGN_NEXT);
        file.Close();
    }
}
开发者ID:ptthisdan,项目名称:DIPVC,代码行数:25,代码来源:MainFrm.cpp

示例3: lock

CReplayFrame::CReplayFrame(void)
{
	__SEH_SET_EXCEPTION_HANDLER

    CTime		time = 0, latest_time = 0;
    int			last_frame_num = -1, frame_num = 0;
    CString		path = "", filename = "", current_path = "";
    CFileFind	hFile;
    BOOL		bFound = false;

	CSLock lock(m_critsec);

	// Find next replay frame number
    _next_replay_frame = -1;

    path.Format("%s\\replay\\session_%lu\\*.bmp", _startup_path, theApp._session_id);
    bFound = hFile.FindFile(path.GetString());
    while (bFound)
    {
        bFound = hFile.FindNextFile();
        if (!hFile.IsDots() && !hFile.IsDirectory())
        {
            filename = hFile.GetFileName();
            hFile.GetLastWriteTime(time);
            sscanf_s(filename.GetString(), "frame%d.bmp", &frame_num);

            if (time>latest_time)
            {
                last_frame_num = frame_num;
                latest_time = time;
            }
        }
    }

    _next_replay_frame = last_frame_num + 1;
    if (_next_replay_frame >= prefs.replay_max_frames())
        _next_replay_frame = 0;
}
开发者ID:seawei,项目名称:openholdem,代码行数:38,代码来源:CReplayFrame.cpp

示例4: FileCopyTo

bool CFileBackUp::FileCopyTo(CString source, CString destination, CString searchStr, BOOL cover)
{
	CString strSourcePath = source;
	CString strDesPath = destination;
	CString strFileName = searchStr;
	CFileFind filefinder;
	CString strSearchPath = strSourcePath + _T("\\") + strFileName;
	CString filename;
	BOOL bfind = filefinder.FindFile(strSearchPath);
	CString SourcePath, DisPath;

	bool bRlt = true;
	while (bfind)
	{
		bfind = filefinder.FindNextFile();
		filename = filefinder.GetFileName();
		SourcePath = strSourcePath + _T("\\") + filename;
		DisPath = strDesPath + _T("\\") + filename;
		bRlt |= CopyFile(SourcePath.GetString(), DisPath.GetString(), cover);
	}
	filefinder.Close();
	return bRlt;
}
开发者ID:killbug2004,项目名称:DvrWorkstation,代码行数:23,代码来源:FileBackUp.cpp

示例5: Refresh

void CFileView::Refresh(char *dir)
{
	// listview을 모두 지운다.
	CListCtrl& list = GetListCtrl(); // !!!!!!!!!!!
	list.DeleteAllItems();
	SetCurrentDirectory( dir );

	CFileFind f; BOOL b = f.FindFile("*.*");

	while ( b )
	{
		b = f.FindNextFile();

		if ( ! f.IsDirectory() && ! f.IsHidden() )
		{
			list.InsertItem(0, f.GetFileName(), 0);
			
			CString msg;
			msg.Format( "%d KB", (f.GetLength() / 1024) + 1 );
			list.SetItemText(0, 1, msg );
		}
	}
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:23,代码来源:FileView.cpp

示例6: AddSubdirectories

void CDirectoryTreeCtrl::AddSubdirectories(HTREEITEM hRoot, CString strDir)
{
	if (strDir.Right(1) != _T("\\"))
		strDir += _T("\\");
	CFileFind finder;
	BOOL bWorking = finder.FindFile(strDir+_T("*.*"));
	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		if (finder.IsDots())
			continue;
		if (finder.IsSystem())
			continue;
		if (!finder.IsDirectory())
			continue;
		
		CString strFilename = finder.GetFileName();
		if (strFilename.ReverseFind(_T('\\')) != -1)
			strFilename = strFilename.Mid(strFilename.ReverseFind(_T('\\')) + 1);
		AddChildItem(hRoot, strFilename);
	}
	finder.Close();
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:23,代码来源:DirectoryTreeCtrl.cpp

示例7: AddSubDirAsItem

BOOL CDirTreeCtrl::AddSubDirAsItem(HTREEITEM hParent)
{
	CString strPath,strFileName;
	HTREEITEM hChild;
	//---------------------去除该父项下所有的子项------------   // 因为有dummy项,并且有时子目录再次打开,或子目录会刷新等,因此必须去除。
	while ( ItemHasChildren(hParent))  {
		hChild = GetChildItem(hParent);
		DeleteItem( hChild );
	}  
	//-----------------------装入该父项下所有子项-------------- 
	strPath = GetFullPath(hParent);  // 从本节点开始到根的路径
	CString strSearchCmd = strPath;
	if( strSearchCmd.Right( 1 ) != _T( "\\" ))
		strSearchCmd += _T( "\\" );

	strSearchCmd += _T( "*.*" );
	CFileFind find;
	BOOL bContinue = find.FindFile( strSearchCmd );
	while ( bContinue )  {
		bContinue = find.FindNextFile();
		strFileName = find.GetFileName(); 

		if ( !find.IsHidden() && ! find.IsDots() && find.IsDirectory() )
		{ 
			hChild = AddItem( hParent, strFileName );
			if ( FindSubDir( GetFullPath(hChild) ))
				AddSubDirAsItem1(hChild); 
		}

		if ( !find.IsHidden() && ! find.IsDots() && !find.IsDirectory() )
		{
			InsertItem( strFileName, 0, 0, hParent );
		}
	}

	return TRUE; 
}
开发者ID:neil-yi,项目名称:ffsource,代码行数:37,代码来源:DirTreeCtrl.cpp

示例8: InitLanguages

static void InitLanguages(const CString& rstrLangDir1, const CString& rstrLangDir2, bool bReInit = false)
{
	static BOOL _bInitialized = FALSE;
	if (_bInitialized && !bReInit)
		return;
	_bInitialized = TRUE;

	CFileFind ff;
	bool bEnd = !ff.FindFile(rstrLangDir1 + _T("*.dll"), 0);
	bool bFirstDir = rstrLangDir1.CompareNoCase(rstrLangDir2) != 0;
	while (!bEnd)
	{
		bEnd = !ff.FindNextFile();
		if (ff.IsDirectory())
			continue;
		TCHAR szLandDLLFileName[MAX_PATH];
		_tsplitpath(ff.GetFileName(), NULL, NULL, szLandDLLFileName, NULL);

		SLanguage* pLangs = _aLanguages;
		if (pLangs){
			while (pLangs->lid){
				if (_tcsicmp(pLangs->pszISOLocale, szLandDLLFileName) == 0){
					pLangs->bSupported = TRUE;
					break;
				}
				pLangs++;
			}
		}
		if (bEnd && bFirstDir){
			ff.Close();
			bEnd = !ff.FindFile(rstrLangDir2 + _T("*.dll"), 0);
			bFirstDir = false;
		}

	}
	ff.Close();
}
开发者ID:acat,项目名称:emule,代码行数:37,代码来源:I18n.cpp

示例9: EnumImage

DWORD CImageManager::EnumImage()
{
	DWORD dwCount = 0;
	CString strFile = m_strImagePath + _T("\\*.*");
	CFileFind fileFind;
	BOOL bFind = fileFind.FindFile(strFile);
	CString strName,strSize,strModifyTime,strExt;
	while (bFind)
	{
		bFind = fileFind.FindNextFile();

		if (!fileFind.IsDirectory())
		{
			strName = fileFind.GetFileName();
			strExt = strName.Right(3);

			if (strExt.CompareNoCase(_T("IMG")) == 0
				|| strExt.CompareNoCase(_T("MTP")) == 0)
			{
				CFileStatus status;
				CFile::GetStatus(fileFind.GetFilePath(),status);

				strSize = CUtils::AdjustFileSize(status.m_size);
				strModifyTime = status.m_mtime.Format(_T("%Y-%m-%d %H:%M:%S"));

				m_ListImages.InsertItem(dwCount,strName);
				m_ListImages.SetItemText(dwCount,1,strSize);
				m_ListImages.SetItemText(dwCount,2,strModifyTime);
				dwCount++;
			}
			
		}
	}
	fileFind.Close();

	return dwCount;
}
开发者ID:Binggoo,项目名称:USBCopy,代码行数:37,代码来源:ImageManager.cpp

示例10: OnInitDialog

BOOL CExportDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CFileFind finder;
	INXString fileName;
	int bWorking = finder.FindFile(workDir + USERDEFDIR + "*.prg");
	
	// read in ini files and construct menu tree
	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		fileName = finder.GetFileName();
		// Remove .prg
		fileName.MakeReverse();
		fileName.Delete(0,4);
		fileName.MakeReverse();
		m_Library.AddString(fileName);
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:pdrezet,项目名称:brix,代码行数:24,代码来源:ExportDialog.cpp

示例11: GetFileName

CString VDEIODLL_EXPORT_API GetFileName(CString strPath,int& nCount)
{
	CString strFileName;
	CFileFind cfFile; //执行本地文件查找
	int i = 0;
	if (strPath.Right(1) != "\\")
	{
		strPath += _T("\\*.avi");
	}else
	{
		strPath += _T("*.avi");
	}

	BOOL bf = cfFile.FindFile(strPath);
	while (bf)
	{
		bf = cfFile.FindNextFile();
		CString cstrFileName;
		cstrFileName = cfFile.GetFileName();
		nCount++;
	}
	strFileName.Format(_T("视频%d"),nCount+1);
	return strFileName;
}
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:24,代码来源:Vedio.cpp

示例12: OnInitDialog

BOOL CSetList::OnInitDialog()
{
	CDialog::OnInitDialog();
	// TODO:  여기에 추가 초기화 작업을 추가합니다.

	CRect	dlgRect;
	GetClientRect(&dlgRect);
	m_lstSetting.MoveWindow(&dlgRect);

	// 파일 목록을 찾는다.
	CFileFind finder;
	CString strWildCard("*.set");

	BOOL bWorking = finder.FindFile( strWildCard );
	while( bWorking )
	{
		bWorking = finder.FindNextFile();
		if( finder.IsDots() || finder.IsDirectory() )
			continue;  
		else
		{
			CString filePath = finder.GetFileName();
			filePath = filePath.Left(filePath.GetLength() - 4);			// 뒤의 .set 을 지우기 위해서
			m_lstSetting.AddString(filePath);
		}
	} 
	finder.Close();

	if(m_lstSetting.GetCount() == 0)
	{
		AfxMessageBox(STR_NO_SETTING_FILE);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다.
}
开发者ID:enildne,项目名称:agilpulse,代码行数:36,代码来源:SetList.cpp

示例13: FindCurrentDirFiles

void COutputTabView::FindCurrentDirFiles()
{
	CString currentDir;
	GetCurrentDirectory( MAX_SIZE_PATH, currentDir.GetBufferSetLength(MAX_SIZE_PATH) );
	//AfxMessageBox(currentDir);
	currentDir.ReleaseBuffer();

	CFileFind finder;
	BOOL bContinue;
	CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();

	if( bContinue = finder.FindFile(_T("*.*")) )
	{
		while(bContinue)
		{
			bContinue = finder.FindNextFile();
			CString strName = finder.GetFileName();
			CString strPath = finder.GetFilePath();
			pMainFrame->m_wndOutputTabView.AddMsg1(strName);		
		}

	}
  
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:24,代码来源:OutputTabView.cpp

示例14: DoCopyFolderFile

void CFileCtrl::DoCopyFolderFile(CString csSourceFolder, CString csDestFolder, CString csSubFileName )
{
	CFileFind find;	
	csSourceFolder.TrimLeft();
	csSourceFolder.TrimRight();
	csSourceFolder = csSourceFolder + "\\";
	csDestFolder.TrimLeft();
	csDestFolder.TrimLeft();
	csDestFolder = csDestFolder + "\\";
	//
	csSubFileName = "*" + csSubFileName;

	CString csFile = csSourceFolder;
	CString csFinalFile = _T("");
	csFinalFile = csFile + csSubFileName;
	BOOL bResult = find.FindFile( csFinalFile );	
	CString file = _T("");
	while(bResult)
	{
		bResult = find.FindNextFile();
		file = find.GetFileName();	// Get File Name
		::CopyFile( csSourceFolder + file, csDestFolder + file, FALSE );
	}
}
开发者ID:iqk168,项目名称:3111,代码行数:24,代码来源:FileCtrl.cpp

示例15: FindAuxiliaryFileByLangid

CString CDirstatApp::FindAuxiliaryFileByLangid(LPCTSTR prefix, LPCTSTR suffix, LANGID& langid, bool checkResource)
{
	CString number;
	number.Format(_T("%04x"), langid);

	CString exactName;
	exactName.Format(_T("%s%s%s"), prefix, number, suffix);

	CString exactPath= GetAppFolder() + _T("\\") + exactName;
	if (FileExists(exactPath) && (!checkResource || IsCorrectResourceDll(exactPath)))
		return exactPath;

	CString search;
	search.Format(_T("%s*%s"), prefix, suffix);

	CFileFind finder;
	BOOL b= finder.FindFile(GetAppFolder() + _T("\\") + search);
	while (b)
	{
		b= finder.FindNextFile();
		if (finder.IsDirectory())
			continue;

		LANGID id;
		if (!ScanAuxiliaryFileName(prefix, suffix, finder.GetFileName(), id))
			continue;

		if (PRIMARYLANGID(id) == PRIMARYLANGID(langid) && (!checkResource || IsCorrectResourceDll(finder.GetFilePath())))
		{
			langid= id;
			return finder.GetFilePath();
		}
	}

	return _T("");
}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:36,代码来源:windirstat.cpp


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