您的最佳的信息源和新聞 xp, 硬件 并且 xp 在互聯網

景色文章 名列前茅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> .