If you use Windows' START >> SEARCH >> FIND FILES OR FOLDERS, there
appears to be some high-performance search capability integrated into
Windows (e.g., a daemon on later versions of Windows is indexing your
hard-drive).
But, aside from the user-interface side of things (e.g., Shell
extension call SHFindFiles), there's NO documentation I can find to
describe how to take advantage of this functionality at the API level.
I would like either:
1) API level access to Windows' built-in START >> SEARCH >> FIND
FILES OR FOLDERS (no user-interface stuff, just API-level only)
...or...
2) A C++ example of the Microsoft Office FileSearch object suitable
for use in Office 97 and later versions of Office - that allows
searching for text inside files.
Thanks. |
Request for Question Clarification by
answerguru-ga
on
19 Jan 2003 11:17 PST
Hi ame1o-ga,
I have come across a resource that is close to what you described above:
This link provides VB code for using the find function in windows:
http://www.freevbcode.com/ShowCode.Asp?ID=2318
Let me know if this satisfies your requirement, or where/how it falls short :)
Thanks,
answerguru-ga
|
Clarification of Question by
ame1o-ga
on
19 Jan 2003 13:24 PST
Thanks for the answer but, no, that does not provide the functionality
I'm looking for. Specifically, I need the exact functionality that
the START >> SEARCH >> FIND FILES OR FOLDERS provides, including the
most important option:
Containing text
I need the ability to find text within the files, just like START >>
SEARCH. My assumption is that later versions of Windows take
advantage of indexing and can speed this operation up significantly.
That's exactly what I need.
Thanks.
|
Dear ame1o-ga,
The "Search" function in Windows 2000 and Windows XP makes use of the
Indexing Service, a system service introduced with the release of
Windows 2000.
"Purpose
-------
Indexing Service is a base service for Microsoft® Windows® 2000 or
later. Formerly known as Index Server, its original function was to
index the content of Internet Information Services (IIS) Web servers.
Indexing Service now creates indexed catalogs for the contents and
properties of both file systems and virtual Webs.
Where Applicable
----------------
Indexing Service is available to applications and scripts for
providing an efficient means of managing, querying, and indexing
information in file systems or Web servers. Indexing Service also
provides query mechanisms for efficiently accessing the information in
the catalogs. The indexed information results from filtering the file
systems and the Web servers using Microsoft-supplied filters and,
optionally, custom-supplied filters. This documentation provides
overview information, task guidance, and reference information for the
programmatic use of Indexing Service."
- Indexing Service Start Page, Microsoft Platform SDK
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/indexingservicestartpage_6td1.asp
"When Indexing Service is running, Start/Search/For Files or Folders
uses the Indexing Service catalog."
- What is Indexing Service?, Microsoft Platform SDK
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixufiles_7uer.asp
Information about this service and programming to it is available both
in the downloadable Windows Platform SDK, and on-line through
msdn.microsoft.com. The first link above (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/indexingservicestartpage_6td1.asp
) takes you directly to the top of the section of the SDK concerned
with Indexing Service.
A simple C++ sample of accessing the Indexing Service catalog to
search the file system is available, which should illustrate the exact
functionality that you mention:
"The Simple sample (QSample) is an example command-line application
written in C++ that executes a query using the OLE DB Helper API
functions CICreateCommand and CITextToFullTree to simplify the coding
needed to create a query to an Indexing Service catalog."
- Simple Sample, Microsoft Platform SDK
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixufilsamp_0sx1.asp
As are a number of other samples in various languages (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixufilsamp_0sx1.asp
).
If this answer isn't quite what you're looking for, please feel free
to request a clarification.
Hope this helps,
cerebrate-ga
Search Strategy:
Personal knowledge.
MSDN Search for "indexing service" -
http://search.microsoft.com/default.asp?qu=indexing+service&boolean=ALL&nq=NEW&so=RECCNT&p=1&ig=01&ig=03&ig=04&ig=05&ig=06&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&i=10&i=11&i=12&i=13&i=14&i=15&i=16&i=17&i=18&i=19&i=20&i=21&i=22&i=23&i=24&i=25&i=26&i=27&i=28&i=29&i=30&i=31&i=32&i=33&i=34&i=35&i=36&i=37&i=38&i=39&i=40&i=41&siteid=us/dev |
Request for Answer Clarification by
ame1o-ga
on
19 Jan 2003 16:42 PST
That's good info, the only question I have is whether there is
something that can be used for Win98, WinME, WinNT4 that would be its
equivalent. Note that I need to support Office97 (per original
message) if at all possible.
All of these systems support the START >> SEARCH >> FOR FILES OR
FOLDERS and I'm wondering whether there's API-level access to that
functionality.
|
Clarification of Answer by
cerebrate-ga
on
21 Jan 2003 05:40 PST
Dear ame1o-ga,
I've been looking into this further.
Earlier versions of Windows - 98, Me and NT 4.0 - do not appear to
expose an API interface to Explorer's search function except for the
SHFindFiles function you mention, and don't incorporate any parallel
to the Indexing Service. Under those systems, especially as your
requirement is specifically to search Office documents, you're almost
certainly best off using the Office "FileSearch" object which makes
use of Office's "Find Fast" indexer.
Unfortunately, this just brings us back to the original problem.
I am now looking at the question of accessing the FileSearch object
from Visual C++. To avoid repeating old ground, could you tell me
which OLB files (or other type libraries) you have used to attempt to
access this object?
Thanks,
cerebrate-ga
|
Request for Answer Clarification by
ame1o-ga
on
21 Jan 2003 06:14 PST
In the Office 97 OLB files for Word and Excel, the "Application"
interface exposes a FileSearch object. However - it doesn't then
expose any methods for dealing with it (!). The only examples I've
found are in VB which presumably used an internal Microsoft OLB. Any
ideas appreciated here, backwards compatibility with Win98/Office97 is
crucial for me.
Thks.
|
Clarification of Answer by
cerebrate-ga
on
21 Jan 2003 07:28 PST
Dear ame1i-ga,
I think I have it. In Office, shared objects, including the FileSearch
object and others that depend on it, are kept in a separate DLL, which
is known as:
MSO.DLL in Office XP
MSO9.DLL in Office 2000
MSO97.DLL in Office 97
If you reference that from your C++ code (it has an embedded type
library), that should give you the methods you need to access the
FileSearch object as per bio-ga's comment below.
Unfortunately, I haven't been able to locate any C++ examples of this
particular operation - the Microsoft information on the subject boils
down to 'translate the VB code into C++' - but more general C++ Office
Automation samples are located at:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q253235
Hope this helps,
cerebrate-ga
|