貝Namespace延長: 深い調査を可能にすること
概観
あなた自身の貝Namespaceの実行についての私の過去のポストから、読者が掲示するあるすばらしい質問がずっとある。 これらの多数はNamespaceの例がかなり単純であるという事実から探検家で可能である行動すべてを実行しないこと生じる。 これは働くNamespaceを実行されて得ることの中心のステップに焦点を合わせるためにされた。 しかし、あなたが踏むことができるあなたの部分のたくさんのより多くのコーディングがより有用な特徴を加えるように要求しない少数の特別なステップがある。 かなり出る1つの質問は特に頻繁にあなたのNamespaceの深く捜索を可能にする方法をである。
探検家の調査箱に調査の言葉を書き入れれば、調査は眺めに現在ある項目だけをろ過することに既存のNamespaceの例から気づく。 それはホールダーに捜さない。 下記のイメージでは、私達は1つの項目だけで起因する調査箱の「2」を捜すことを試みる。 従って、補助的なホールダーは含まれていなかった。
namespaceの調査の結果に補助的なホールダーを含めるためにNamespaceのインプリメンターは何をしなければならないか。 これは実際にかなり単純である。
IShellFolderViewCBおよびIFolderViewSettingsの実行
私達の前のコードでは、私達は実行しなかった IShellFolderViewCB 私達のNamespaceのため。 これはあなたのNamespaceが眺めと関連付けられるでき事の知らせられるようにする。 IShellFolderViewCBの実施はあなたの呼出しでへの指定することができる SHCreateShellFolderView. これは任意であり、前に私達はちょうどこれのための0を渡していた。 私達は道具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:
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
- To build the FolderViewImpl sample, be sure to download and install the Windows SDK.
- Download the modified FolderView SDK sample
- Launch FolderViewImpl.sln in Visual Studio (The solution file is for Visual Studio 2008)
- Open the properties for the project
- Add a path to the SDK includes to the C/C++ - General page
- Add a path to the SDK libs to the Linker – General page
- Build
Installing the FolderView SDK Sample
- Once you have built the sample, copy the FolderViewImpl.dll and FolderViewImpl.propdesc to the same directory
- From an elevated cmd window, regsvr32 FolderViewImpl.dll
- Restart explorer
- Open explorer to Computer
- There should be a list item named “FolderView SDK Sample”
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.
- [+] Digg: Feature this article
- [+] Del.icio.us: Bookmark this article
- [+] Furl: Bookmark this article














