Hi,
I want to write some application that looking some file name ( "file.exe" or "*.exe" ) on the entire disk.
Can some one help me ?
Printable View
Hi,
I want to write some application that looking some file name ( "file.exe" or "*.exe" ) on the entire disk.
Can some one help me ?
Take a look at CFileFind class
Please dont cross post the same question you already got an answer here.
Cheers
Here this is how u do it.
If u dont want to use string<> u can use some ting else ...Code:char szPath[MAX_PATH];
BROWSEINFO lpbi;
::ZeroMemory(&lpbi,sizeof(BROWSEINFO));
ITEMIDLIST *folder = ::SHBrowseForFolder(&lpbi);
::SHGetPathFromIDList(folder,szPath);
CFileDialog cd(1,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,NULL,NULL);
cd.DoModal();
CString sFullMask = szPath + CString("\\*.*");
list<string> ldf;
CFileFind finder;
bool bFound;
bFound=finder.FindFile(sFullMask);
while ((bFound))
{
bFound = finder.FindNextFile();
if (!finder.IsDots())
{
// Add file to list
string sName = finder.GetFilePath();
if (finder.IsDirectory()) sName += "\\";
ldf.push_back(sName);
}
}
:wave:
Check out this wonderful FAQ
PS: Please do make it a habbit to use the search option.