以编程方式搜索 Windows 7,无需使用 sdk 库
有没有办法用参数调用 SearchIndexer ? (或者还有其他方法可以实现标题所说的功能吗?)
我尝试查看各种 MSDN 文章,但它们似乎都建议我使用库。但是当我运行搜索时,它就会运行,而无需我下载任何类型的库。
回到 XP 时代,您可以转到索引服务属性并执行查询。我在 Windows 7 中看不到这一点。
谢谢。
Is there a way to call SearchIndexer with arguments? (or is there another way to accomplish what the title says?)
I tried looking at the various MSDN articles, but they all seemed to suggest that I use a library. But when I run the search, it runs, without me downloading any sort of library.
Back in the days of XP, you could go to the indexing service properties and execute a query. I don't see that in Windows 7.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个示例查询。请注意,它不使用 Windows 7 SDK。
但是,它是根据 Windows 7 SDK 中的 DSearch 示例改编的。 ([SDK]\Samples\winui\WindowsSearch\DSearch。[SDK]通常是“C:\Program Files\Microsoft SDKs\Windows\v7.1”
请注意,您可以使SQL查询更容易(但在我看来稍微不太灵活) )如果您使用 SDK 的
ISearchQueryHelper
,但要使用该类和相关类,您需要引用Microsoft.Search.Interop
,该类未包含在 Windows 7 中。 SDK为但是,您可以通过在 SearchAPI.tlb 文件(在 [SDK]\Lib 中)上使用 TlbImp.exe(类型库导入程序,在 [SDK]\bin 中)以 dll 形式获取它。 href="http://social.msdn.microsoft.com/Forums/en-US/windowssearch/thread/0a130e9d-4710-4a72-bf9e-272a3f0128d6/" rel="nofollow">此处也有描述。我希望这篇文章对需要以编程方式连接到 Windows 7 或更高版本中的 Windows 搜索的其他人有所帮助。
Here's an example query. Note that it does not use the Windows 7 SDK.
However, it was adapted from the DSearch example in the Windows 7 SDK. ([SDK]\Samples\winui\WindowsSearch\DSearch. [SDK] is typically "C:\Program Files\Microsoft SDKs\Windows\v7.1"
Note that you can make the SQL query more easily (but slightly less flexible imo) if you use the SDK's
ISearchQueryHelper
. To use that class and related classes though, you need have reference toMicrosoft.Search.Interop
, which is not included in the Windows 7 SDK as a dll. You can however get it in dll form by using TlbImp.exe (type library importer, in [SDK]\bin) on the SearchAPI.tlb file (in [SDK]\Lib). Also described here.I hope this post helps anyone else who needs to programmatically connect to the Windows Search in Windows 7 or higher.