469,578 Members | 1,913 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Win32 API for Search!

Hi All, Planning to call the same search API which windows Search uses for
searching , when u launch with Ctrl+F,you have the flexibility to provide a
containing text!

VB/C# any thing would work

My search wants to use Containing text

Thanks
Preferred OS:Win2k3
Apr 10 '07 #1
13 5550
Vai2000,

You are going to have to make calls to the Win32 API through the
P/Invoke layer. Specifically, the API functions you want are
FindFirstFileEx, FindNextFile and FindClose.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vai2000" <no****@microsoft.comwrote in message
news:OL****************@TK2MSFTNGP03.phx.gbl...
Hi All, Planning to call the same search API which windows Search uses for
searching , when u launch with Ctrl+F,you have the flexibility to provide
a
containing text!

VB/C# any thing would work

My search wants to use Containing text

Thanks
Preferred OS:Win2k3


Apr 10 '07 #2
Vai2000 wrote:
Hi All, Planning to call the same search API which windows Search uses for
searching , when u launch with Ctrl+F,you have the flexibility to provide
a containing text!

VB/C# any thing would work

My search wants to use Containing text

Thanks
Preferred OS:Win2k3
You might also be interested in
http://addins.msn.com/devguide.aspx#...sktopSearchApi.
--
Tom Porterfield

Apr 10 '07 #3
It should be noted that this approach has some caveats, those being:

- The machine that this is run on has to have Windows Desktop Search
installed, located at:

http://www.microsoft.com/windows/des...h/default.mspx

- The directories that the documents reside in have to be indexed by Windows
Desktop Search. If they are not, then a search using these APIs will
produce nothing.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:eW**************@TK2MSFTNGP02.phx.gbl...
Vai2000 wrote:
>Hi All, Planning to call the same search API which windows Search uses
for
searching , when u launch with Ctrl+F,you have the flexibility to provide
a containing text!

VB/C# any thing would work

My search wants to use Containing text

Thanks
Preferred OS:Win2k3

You might also be interested in
http://addins.msn.com/devguide.aspx#...sktopSearchApi.
--
Tom Porterfield

Apr 10 '07 #4
Nicholas Paldino [.NET/C# MVP] wrote:
It should be noted that this approach has some caveats, those being:

- The machine that this is run on has to have Windows Desktop Search
installed, located at:

http://www.microsoft.com/windows/des...h/default.mspx
Seems obvious that if you want to use the windows desktop search API that it
needs to be installed, but thanks for stating such. WDS is included in
Vista and is supposed to be in Longhorn Server as well.
- The directories that the documents reside in have to be indexed by
Windows Desktop Search. If they are not, then a search using these APIs
will produce nothing.
Yes, but the interface is much more robust than FindFirstFileEx, if it meets
your needs. Don't know if the API will be advanced for Vista and LH Server
but in Vista using the built in search interface you can via advanced
options also have it search non-indexed locations.
--
Tom Porterfield

Apr 10 '07 #5
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:eU**************@TK2MSFTNGP03.phx.gbl...
Nicholas Paldino [.NET/C# MVP] wrote:
> It should be noted that this approach has some caveats, those being:

- The machine that this is run on has to have Windows Desktop Search
installed, located at:

http://www.microsoft.com/windows/des...h/default.mspx

Seems obvious that if you want to use the windows desktop search API that it needs to be
installed, but thanks for stating such. WDS is included in Vista and is supposed to be in
Longhorn Server as well.
>- The directories that the documents reside in have to be indexed by
Windows Desktop Search. If they are not, then a search using these APIs
will produce nothing.

Yes, but the interface is much more robust than FindFirstFileEx, if it meets your needs.
Don't know if the API will be advanced for Vista and LH Server but in Vista using the
built in search interface you can via advanced options also have it search non-indexed
locations.
--
Tom Porterfield

The search engine in Vista is not related to the MSN Desktop Search nor is the API.

Willy.

Apr 10 '07 #6
Willy Denoyette [MVP] wrote:
>
The search engine in Vista is not related to the MSN Desktop Search nor
is the API.
Interesting and not what I have been told by other sources.
--
Tom Porterfield
Apr 10 '07 #7
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
Willy Denoyette [MVP] wrote:
>>
The search engine in Vista is not related to the MSN Desktop Search nor
is the API.

Interesting and not what I have been told by other sources.
--
Tom Porterfield

Windows Desktop Search, which is installed with MSN Search Toolbar and Windows Desktop
Search built into Vista have similar functionality but they are not the same. The SDK and
the sample you are referring to in your initial reply do not work on Vista, apparently the
COM component that comes with MSN's Desktop Search is not the same as Vista's Search COM
server (MSSCTLB and MSSITLB - mssrch.dll and mssitlb.dll).

Willy.
Apr 10 '07 #8
The search feature in Windows has supported searching files for text strings
since at least Windows 95, well before either indexing or WDS. What it does
is uses the FindFirst/NextFile APIs to match the file template and then
opens the found files for ascii (as opposed to unicode) binary read to scan
for the requested text.

Mike Ober.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OE****************@TK2MSFTNGP06.phx.gbl...
It should be noted that this approach has some caveats, those being:

- The machine that this is run on has to have Windows Desktop Search
installed, located at:

http://www.microsoft.com/windows/des...h/default.mspx

- The directories that the documents reside in have to be indexed by
Windows Desktop Search. If they are not, then a search using these APIs
will produce nothing.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:eW**************@TK2MSFTNGP02.phx.gbl...
>Vai2000 wrote:
>>Hi All, Planning to call the same search API which windows Search uses
for
searching , when u launch with Ctrl+F,you have the flexibility to
provide
a containing text!

VB/C# any thing would work

My search wants to use Containing text

Thanks
Preferred OS:Win2k3

You might also be interested in
http://addins.msn.com/devguide.aspx#...sktopSearchApi.
--
Tom Porterfield


Apr 11 '07 #9
Willy Denoyette [MVP] wrote:
Windows Desktop Search, which is installed with MSN Search Toolbar and
Windows Desktop Search built into Vista have similar functionality but
they are not the same.
That seems to contradict the following statement:

"Windows Search is a standard component of Microsoft Windows Vista enabled
by default and an add-in for Windows XP which allows instant search
capabilities for most common file and data types such as e-mail, contacts,
calendar appointments, documents, photos, multimedia, and other formats
extended by third-parties. These capabilities enable consumers and
Information Workers to more efficiently find, manage, and organize the
increasing amount of data common in home and enterprise environments."

http://msdn2.microsoft.com/en-us/library/aa965362.aspx

The SDK and the sample you are referring to in
your initial reply do not work on Vista, apparently the COM component
that comes with MSN's Desktop Search is not the same as Vista's Search
COM server (MSSCTLB and MSSITLB - mssrch.dll and mssitlb.dll).
I see that now. Should have pointed to
http://msdn2.microsoft.com/en-us/library/bb331575.aspx instead.
--
Tom Porterfield

Apr 11 '07 #10
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:OE*************@TK2MSFTNGP05.phx.gbl...
Willy Denoyette [MVP] wrote:
>Windows Desktop Search, which is installed with MSN Search Toolbar and
Windows Desktop Search built into Vista have similar functionality but
they are not the same.

That seems to contradict the following statement:

"Windows Search is a standard component of Microsoft Windows Vista enabled by default and
an add-in for Windows XP which allows instant search capabilities for most common file and
data types such as e-mail, contacts, calendar appointments, documents, photos, multimedia,
and other formats extended by third-parties. These capabilities enable consumers and
Information Workers to more efficiently find, manage, and organize the increasing amount
of data common in home and enterprise environments."

http://msdn2.microsoft.com/en-us/library/aa965362.aspx
True, but "Windows Search" != "Windows Desktop Search" which is what you were refering to
and confused me.
Windows Search is standard in Vista and optional in XP, they offer similar functionality but
they aren't exactly the same, Vista has more features.

>
>The SDK and the sample you are referring to in
your initial reply do not work on Vista, apparently the COM component
that comes with MSN's Desktop Search is not the same as Vista's Search
COM server (MSSCTLB and MSSITLB - mssrch.dll and mssitlb.dll).

I see that now. Should have pointed to
http://msdn2.microsoft.com/en-us/library/bb331575.aspx instead.
--
This is brand new (Microsoft Windows Search 3.x SDK Date Published: 3/9/2007 ), I have
installed the SDK on Vista, and the samples seems to work, be it only on indexed scopes.
The SDK comes with an hand made Interop Assembly (Microsoft.Search.Interop), so you don't
need to set a reference to the underlying COM server. However, the IA is hand tuned, and
exposes only the common COM interfaces available on XP and W2K3 and Vista. However, if you
compare the IA with the COM server (mssrch) Interfaces on Vista you will see that the IA is
missing some Interfaces.

Willy.
Apr 11 '07 #11
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
True, but "Windows Search" != "Windows Desktop Search" which is what you
were refering to and confused me.
Windows Search is standard in Vista and optional in XP, they offer similar
functionality but they aren't exactly the same, Vista has more features.

Again, this doesn't match what I have been told from other sources. The GUI
is different and allows more options in Vista but the underlying technology
is the same.
--
Tom Porterfield

Apr 12 '07 #12
"Michael D. Ober" <obermd.@.alum.mit.edu.nospamwrote in message
news:OL**************@TK2MSFTNGP04.phx.gbl...
The search feature in Windows has supported searching files for text
strings since at least Windows 95, well before either indexing or WDS.
What it does is uses the FindFirst/NextFile APIs to match the file
template and then opens the found files for ascii (as opposed to unicode)
binary read to scan for the requested text.

Yes, a fairly inefficient way to search for text in files, but if it's all
you got it's all you got.
--
Tom Porterfield

Apr 12 '07 #13
"Tom Porterfield" <tp******@mvps.orgwrote in message
news:00**********************************@microsof t.com...
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>True, but "Windows Search" != "Windows Desktop Search" which is what you were refering
to and confused me.
Windows Search is standard in Vista and optional in XP, they offer similar functionality
but they aren't exactly the same, Vista has more features.


Again, this doesn't match what I have been told from other sources. The GUI is different
and allows more options in Vista but the underlying technology is the same.
I stand corrected, you are right, I thought that the "Property System" was only available on
Vista, but I see that now it's also been made available to XP and W2K3 through "Windows
Search 3.0" and up.

So the underlying technology is identical.

mssrch.dll
mssitlb.dll
mssprxy.dll
SearchIndexer.exe
SearchFilterHost.exe
SearchProtocolHost.exe

are common for XP, W2K3 and Vista.

The Interop Assembly that comes with the "Windows Search 3.0 SDK" only reflects part of the
search functionality. The IA is hand made subset from the interface definitions in
searchAPI.h, however it doesn't expose all interfaces, notably it doesn't expose any of the
Sink interfaces.
Note that the Property System as used by the Explorer *Search* is not exposed through COM,
you need to PInvoke propsys.dll exported functions for this.

Willy.

Apr 12 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David Douard | last post: by
1 post views Thread by RL | last post: by
6 posts views Thread by Rajesh | last post: by
13 posts views Thread by dumpingrounds | last post: by
48 posts views Thread by Daniele C. | last post: by
4 posts views Thread by rob | last post: by
saranjegan
reply views Thread by saranjegan | last post: by
1 post views Thread by Sin Jeong-hun | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.