|
Try going into FileFinder.cpp at line 120 and replace the follow code...
if (GET_SAFE(m_pss->m_bRecurse))
{
ok = GetSubDirs(csaSearchFolders, csSearchFolder);
}
else
{
csaSearchFolders.Add(csSearchFolder);
}
with this...
>
csaSearchFolders.Add(csSearchFolder);
if (GET_SAFE(m_pss->m_bRecurse))
{
ok = GetSubDirs(csaSearchFolders, csSearchFolder);
}
Chris
|
|
|
|
|
In the FileFinder.cpp Line 175 replace the following...
CString searchString = curDir + "\\";
searchString+=GET_SAFE(m_pss->m_csFindFile);
with the following...
CString searchString = curDir + "\\*";
searchString+=GET_SAFE(m_pss->m_csFindFile);
searchString+="*";
Chris
|
|
|
|
|
First off, great job and thanks for making this available. I would really like to use this as part of an auto-upgrade feature. I have a 150gig HD so this really takes some time to build the folder list and requires quite a few CPU cycles. So I want it to use it in the background and run when the computer is idle. I've tried changing AfxBeginThread to THREAD_PRIORITY_LOWEST and THREAD_PRIORITY_IDLE but it made no difference. Any ideas?
|
|
|
|
|
Not really a fault of your program I don't suppose, but when I run your program using for example *.doc across all my hard drives I get lots of these:
E:\RECYCLER\S-1-5-21-1715567821-1957994488-1060284298-500\De595.doc
E:\RECYCLER\S-1-5-21-1715567821-1957994488-1060284298-500\De596.doc
E:\RECYCLER\S-1-5-21-1715567821-1957994488-1060284298-500\De597.doc
When I look in Explorer at these folders, I see it says eg 988 files - but cannot see any of the files. A bit strange. I suppose that perhaps best bet would be to excluded RECYCLER directory. I am running Windows 2000. I wonder if called RECYCLER on other Windows platforms?
Angus Comber
ac@NOSPSMiteloffice.com
|
|
|
|
|
ok i don't konw too many english, but i try to explain,
first, every logic driver has one X:\RECYCLER, (only hard disk). internally Wondows uses these folders to manage the "deleted files", but before you eliminate it "forever".
second that files should be at the WINDOWS RECYCLER.
third, did you see all files?, did you see hidden and system protected files too? if you want to see these files, go to your EXPLORER > TOOLS and go to the last option, something about "folders options", (i don't have Windows 2000 and i haven't see it in english) then search there in > View options that allows to see the files
DgMv
|
|
|
|
|
I'm developing a similar search dialog but am trying to start it in a separate thread, so that the user can minimize it or move it aside and continue working with the main dialog window while the search goes on. I partially succeeded by creating a CWinThread object in the main window dialog which in turn creates the dialog in a non-modal fashion (otherwise it would still retain the focus); the CWinThread::m_pMainWnd then takes on the address of the search dialog. I'm having a leak in the IMPLEMENT_DYNCREATE macro of the CWinThread object which i can't eliminate...anyone ever encountered a similar problem?
|
|
|
|
|
For the interested parties...I managed to find a piece of code that solves the above problem on the MSDN website. The sample name is MTMDI and can be found in the Advanced MFC Samples area.
Apparently the memleak occurs because the main application terminates before the threaded dialog closes, leaving the dialog object behind. The above sample uses a system of messages to raise an event whenever the application prepares to close, causing the threaded windows to destroy themselves. The main application then uses WaitForSingleObject calls to wait until the threaded windows are closed before exiting.
|
|
|
|
|
If you search for *.Doc in C:\ with the recursive search ON then ONLY files in subdirs that match *.Doc are found, none in C:\ are found.
Is this just me ? I would have thought that someone would have picked up on this by now?
I changed the following:
ORIGINAL CODE
------------------------------------
if (GET_SAFE(m_pss->m_bRecurse))
{
ok = GetSubDirs(csaSearchFolders, csSearchFolder);
}
else
{
csaSearchFolders.Add(csSearchFolder);
}
NEW CODE
------------------------------------
csaSearchFolders.Add(csSearchFolder);
if (GET_SAFE(m_pss->m_bRecurse))
ok = GetSubDirs(csaSearchFolders, csSearchFolder);
Matt.
|
|
|
|
|
Hello!
If I set m_csRootFolder = "" then the returned path's will be wrong. There will be an extra \ after the drive, e.g. C:\\TEMP\XYZ.TXT
The error is in the CFileFinder::GetLocalDriveRoots() Where you first put a '\\' in buf and then
t = buf;
t += "\\";
To fix it: remove the t += "\\"; line
// Mike
|
|
|
|
|
i think it would be better to consider a root folder of "" to be an error - there really is no valid folder called "".
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Hmmm...
this is from your code
// these next three options aren't strictly necessary here, because
// we've already specified a root folder. if we left the root folder
// blank (""), the code will search drives A through Z.
Which I interpret as if I want to search all drives, A to Z, I should set m_csRootFolder = "";
If this isn't the case(?) then you'd better change the comments!
//Mike
|
|
|
|
|
ok. you got me.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I debugged the sources and found, that there is a small bug in CFileFinder::GetSubDirs(....)
mustn't it be:
CString searchString;
while (path.GetAt(path.GetLength()-1)=='\\')
path =path.Left(path.GetLength()-1);
searchString=path+"\\*.*";
I replaced that if-else condition with the while-loop and it's working for me now....
Bye,
M. K
|
|
|
|
|
wouldn't this only be a problem if you were sending paths in with multiple trailing '\' characters
|
|
|
|
|
I downloaded the sample project, just only pressing the start button after compiling, and nothing happens, only the find file dialog flashes for a short time, so I debugged, I had made no changes in the source code, just only searched for win.ini on disk C:\ and found out, that the variable 'path' is C:\\ for me, my computer is connected to the intranet. So I changed the source code lines as stated above and now it is working for me...., funny, isn't it ??
Bye,
M. K
|
|
|
|
|
I tried running this demo and I got thousands of string dumps in my output window. What gives??
|
|
|
|
|
i have no idea... it's never leaked on me.
can you give a little more info? (OS, development env. maybe
|
|
|
|
|
are you sure they were memory leaks ?
the demo prints the names of the files that it found to the debug window.
-
|
|
|
|
|
I am running Windows 2000 and I used Visual C++ 6.0 SP4 to compile the project. These are the errors I get in my debug window when I press Cancel:
--------------
Found 943 folders
found 0
Cancel
Detected memory leaks!
Dumping objects ->
thrdcore.cpp(166) : {74} client block at 0x002F4928, subtype 0, 112 bytes long.
a CWinThread object at $002F4928, 112 bytes long
Object dump complete.
The thread 0x3BC has exited with code 0 (0x0).
The thread 0x36C has exited with code 0 (0x0).
The program 'C:\FindFile\Debug\findfile.exe' has exited with code 0 (0x0).
------------
Also, when I hit the cancel button, and tried to run it again, I got an unhandled exception in NTDLL.DLL.
|
|
|
|
|
ah... well, it's not really the "thousands" that you mentioned before.
but, it should be fixed in the code that's available now.
-
|
|
|
|
|
Here's code that you can copy and paste into your program right now to use Windows' Find Files dialog box:
#include <shldisp.h>
#include <afxdisp.h>
static BOOL FindAllFilesThenComputers()
{
if (!AfxOleInit())
return FALSE;
HRESULT hResult = ::CoInitialize(NULL);
IShellDispatch* pShellDisp = NULL;
hResult = ::CoCreateInstance(CLSID_Shell,
NULL, CLSCTX_SERVER,
IID_IShellDispatch, (void**)&pShellDisp);
if (FAILED(hResult) || pShellDisp == NULL)
return FALSE;
// Call the IShellDispatch::FindFiles() method
// to invoke Windows' Find Files dialog that you
// get from the Start menu
pShellDisp->FindFiles();
// Call the IShellDispatch::FindComputer() method
// to find a computer. This works as if you clicked
// the Start button, moved to Find, and then clicked
// Computers...
pShellDisp->FindComputer();
// When we're done with the IShellDispatch interface,
// we need to call pShellDisp->Release();
pShellDisp->Release();
// Cleanup
::CoFreeUnusedLibraries();
::CoUninitialize();
return TRUE;
}
And there, we're done. It took a little bit of coding, but at least one doesn't have to re-invent the wheel...
Also, make sure you've downloaded and installed the Platform SDK from Microsoft's site at http://msdn.microsoft.com/downloads/sdks/platform/platform.asp. Download it, and then do a 'Typical' install to get the headers and libs that you need.
Yours,
Brian Hart
|
|
|
|
|
Hey Everybody, a little correction
The #include lines didn't get carried over right by The Code Project's wonderful scripts...
Here they are:
#include < shldisp.h >
#include < afxdisp.h >
Also, here's a link to the Platform SDK:
http://msdn.microsoft.com/downloads/sdks/platform/platform.asp
Hope this helps!
Brian Har
|
|
|
|
|
Hello Brian,
Why not just call ShellExecute with the verb "find" to get
the dialog up and running? You love hard work, eh?
Regards,
Paul.
|
|
|
|
|
Helpful tips, but how to get the result?
|
|
|
|
|
:how to get the results?
you can't.
that's why i wrote CFindFileDlg.
-
|
|
|
|