Download demo project - 21 Kb
Introduction
Because we couldn't find out how to use the Windows "Find Files or Folders" dialog in our own app, and we needed to be able to retrieve a list of the files that were found in our app (which I don't think the Windows dialog even allows you to do), we wrote our own.
CFindFileDlg
is a simple dialog class that you can use to search hard drives (or floppy, or network, or CDROM drives) for files. It supports wildcards, and recursive folder searching, allows you to end the search after the first file is found, comes standard with a cancel button, simple animated icon and is fully multi-threaded.
Integrating CFindFileDlg into your own application
- Add these files to your project:
- FileFindDlg.cpp, FileFindDlg.h
- FileFinder.cpp, FileFinder.h
- Copy the IDD_FIND_FILE dialog from the demo resource file to your project
- Copy the 12 animation icons (IDI_ICON1 -> IDI_ICON12) from the demo resource to your project
- #include "FindFileDlg.h" in the file where you want to use the dialog.
Using CFindFileDlg
CFindFileDlg dlg;
dlg.m_csRootFolder = "C:\\";
dlg.m_csFindFile = "file.ext";
dlg.m_bRecurse = true;
dlg.m_bFindSingleFile = false;
dlg.m_bSearchNetworkDrives = false;
dlg.m_bSearchRemovableDrives = false;
dlg.m_bSearchCDROMDrives = false;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
History
20 Mar 2001 - udpated zip
Chris Losinger was the president of Smaller Animals Software, Inc. (which no longer exists).