您的最佳的信息源和新闻 景色硬件, 软件 并且 winvista 在互联网

景色文章 名列前茅50 景色录影 景色软 景色帮助

壳Namespace引伸: 使能深刻的查寻


概要

从我的过去岗位关于实施您自己的壳Namespace,有读者张贴的一些了不起的问题。 许多这些源于事实Namespace例子是相当简单的因为它不实施是可能的在探险家的所有行为。 这在得到运作的Namespace做集中于核心步被实施。 然而,有在您的部分不要求许多更多编制程序增加更加有用的特点的几附加步您能采取。 相当出来的一个问题特别是经常是如何使能深深搜寻在您的Namespace。

您从现有的Namespace例子将注意,如果您在查寻箱子在探险家输入查寻期限,查寻只过滤当前在看法的项目。 它不搜寻入文件夹。 在下面图象,我们设法搜寻“二”在只导致1个项目的查寻箱子。 因此,次级文件夹不是包括的。

过滤器查寻

过滤器结果-浅

Namespace实施必须做什么为了包括次级文件夹在他们的namespace查寻结果? 这实际上是相当简单的。

实施IShellFolderViewCB和IFolderViewSettings

用我们的早先代码,我们没有实施 IShellFolderViewCB 为我们的Namespace。 这允许您的Namespace被通报事件与看法相关。 IShellFolderViewCB的实施在您的电话可以指定 SHCreateShellFolderView. 这是任意的,并且早先我们是正义的通过零位为此。 我们需要创造类那贯彻IShellFolderViewCB并且 IFolderViewSettings. 为我们的IFolderViewSettings实施,我们只需要提供一个经理为 GetFolderFlags 方法。 是通过这个方法我们通知壳我们在我们的Namespace之内想要执行深刻的查寻。

IFACEMETHODIMP CFolderViewCB : :GetFolderFlags (__out FOLDERFLAGS *pfolderMask, __out FOLDERFLAGS *pfolderFlags)

{

如果(pfolderMask)

{

*pfolderMask = FWF_USESEARCHFOLDER;

}

如果(pfolderFlags)

{

*pfolderFlags = FWF_USESEARCHFOLDER;

}

回归S_OK;

}

您能从GetFolderFlags的上述实施看,我们只关心通知FWF_USESEARCHFOLDER旗子的壳。 这告诉壳我们的Namespace应该为进行堆积和搜寻使用查寻文件夹。 您也可能 指定其他旗子 修改您的namespace出现和行为。

修改过的代码为这个样品下面连接。 您注意IShellFolderViewCB和IFolderViewSettings的实施是相当稀稀落落的-多数方法正义回归E_NOTIMPL,因为我们这里不使用他们。 You can implement these yourself if you see the need to extend your code.
Now that we have notified the Shell to use the Search Folder, we can perform deep searches within our Namespace. When we perform the same search we did previously, we now get the following results:

deep search

This Namespace simply generates 10 virtual items to a default depth of 5. The Search enumerates the contents of the Namespace to that depth. It should also be called out that we had to implement our namespace's ParseDisplayName method in order for our namespace to function in the Search folder.

*Please note that the method described here only works with the default shell view (Defview). It is not supported for custom IShellView implementations.

Building the FolderView SDK Sample

  1. To build the FolderViewImpl sample, be sure to download and install the Windows SDK.
  2. Download the modified FolderView SDK sample
  3. Launch FolderViewImpl.sln in Visual Studio (The solution file is for Visual Studio 2008)
  4. Open the properties for the project
  5. Add a path to the SDK includes to the C/C++ - General page
  6. Add a path to the SDK libs to the Linker – General page
  7. Build

Installing the FolderView SDK Sample

  1. Once you have built the sample, copy the FolderViewImpl.dll and FolderViewImpl.propdesc to the same directory
  2. From an elevated cmd window, regsvr32 FolderViewImpl.dll
  3. Restart explorer
  4. Open explorer to Computer
  5. There should be a list item named “FolderView SDK Sample”

Popularity: 1%


Written by chrdavis. Read more great feeds at is source WEBSITE
no comments.
Read more articles on namespace and otherSoftware and extension and Search and Organize and shell and Coding and Programming and vista and search and API and Windows Vista.

Related articles

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .