<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://shellrevealed.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Shell Blog</title><subtitle type="html" /><id>http://shellrevealed.com/blogs/shellblog/atom.aspx</id><link rel="alternate" type="text/html" href="http://shellrevealed.com/blogs/shellblog/default.aspx" /><link rel="self" type="application/atom+xml" href="http://shellrevealed.com/blogs/shellblog/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.60809.935">Community Server</generator><updated>2006-10-31T14:26:00Z</updated><entry><title>Shell Namespace Extension: Enabling Deep Search</title><link rel="alternate" type="text/html" href="http://shellrevealed.com/blogs/shellblog/archive/2008/03/03/Shell-Namespace-Extension_3A00_-Enabling-Deep-Search.aspx" /><id>http://shellrevealed.com/blogs/shellblog/archive/2008/03/03/Shell-Namespace-Extension_3A00_-Enabling-Deep-Search.aspx</id><published>2008-03-03T20:50:00Z</published><updated>2008-03-03T20:50:00Z</updated><content type="html">&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;font color="#4f81bd" face="Cambria" size="4"&gt;Overview&lt;/font&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;From my past posts about implementing your own Shell Namespace, there have been some great questions posted by readers.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Many of these stem from the fact that the Namespace example is fairly simple in that it does not implement all of the behavior that is possible in Explorer.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This was done to focus on the core steps in getting a working Namespace implemented.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Yet, there are a few extra steps you can take that don&amp;rsquo;t require too much more coding on your part to add more useful features.&lt;span&gt;&amp;nbsp; &lt;/span&gt;One question in particular that comes up quite often is how to enable deep searching in your Namespace.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;You will notice from the existing Namespace example that if you enter a search term in the search box in Explorer, the search only filters items that are currently in the view.&lt;span&gt;&amp;nbsp; &lt;/span&gt;It does not search into the folders.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In the below images, we try to search for &amp;ldquo;Two&amp;rdquo; in the search box which only results in 1 item.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Thus, the sub folders were not included.&lt;/font&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;font face="Calibri" size="3"&gt;&lt;img alt="Filter Search " height="300" src="http://shellrevealed.com/photos/blog_images/images/7779/original.aspx" style="width:400px;height:300px;" title="Filter Search " width="400" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;font face="Calibri" size="3"&gt;&lt;img alt="Filter Results - shallow" height="300" src="http://shellrevealed.com/photos/blog_images/images/7780/original.aspx" style="width:400px;height:300px;" title="Filter Results - shallow" width="400" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;What does a Namespace implementer have to do in order to include sub folders in their namespace search results?&lt;span&gt;&amp;nbsp; &lt;/span&gt;This is actually fairly simple.&lt;/font&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;font color="#4f81bd" face="Cambria" size="4"&gt;Implementing IShellFolderViewCB and IFolderViewSettings&lt;/font&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;In our previous code, we did not implement an &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb774967(VS.85).aspx"&gt;&lt;font face="Calibri" size="3"&gt;IShellFolderViewCB&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; for our Namespace.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This allows your Namespace to be notified of events associated with the view.&lt;span&gt;&amp;nbsp; &lt;/span&gt;An implementation of IShellFolderViewCB can be specified in your call to &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb762141(VS.85).aspx"&gt;&lt;font face="Calibri" size="3"&gt;SHCreateShellFolderView&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This is optional and previously we were just passing NULL for this. &lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;We need to create a class that implements IShellFolderViewCB as well as &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb775511(VS.85).aspx"&gt;&lt;font face="Calibri" size="3"&gt;IFolderViewSettings&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For our IFolderViewSettings implementation, we only need to provide a handler for the &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb775499(VS.85).aspx"&gt;&lt;font face="Calibri" size="3"&gt;GetFolderFlags&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; method.&lt;span&gt;&amp;nbsp; &lt;/span&gt;It is through this method that we notify the Shell that we want to perform deep searches within our Namespace.&lt;/font&gt;&lt;/p&gt;&lt;font face="Calibri" size="3"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;IFACEMETHODIMP CFolderViewCB::GetFolderFlags(__out FOLDERFLAGS *pfolderMask, __out FOLDERFLAGS *pfolderFlags)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (pfolderMask)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*pfolderMask = FWF_USESEARCHFOLDER;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (pfolderFlags)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;*pfolderFlags = FWF_USESEARCHFOLDER;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return S_OK;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;As you can see from the above implementation of GetFolderFlags, we only care to notify the Shell of the FWF_USESEARCHFOLDER flag.&amp;nbsp; This tells the Shell that our Namespace should use the Search Folder for performing stacking and searching.&amp;nbsp; You could also &lt;a href="http://msdn2.microsoft.com/en-us/library/bb762508(VS.85).aspx"&gt;specify other flags&lt;/a&gt; to modify the appearance and behavior of your namespace.&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;The modified code for this sample is linked below.&amp;nbsp; You will notice that the implementation of IShellFolderViewCB and IFolderViewSettings is rather sparse &amp;ndash; most methods just return E_NOTIMPL as we are not using them here.&amp;nbsp;&amp;nbsp; You can implement these yourself if you see the need to extend your code. &lt;br /&gt;Now that we have notified the Shell to use the Search Folder, we can perform deep searches within our Namespace.&amp;nbsp; When we perform the same search we did previously, we now get the following results:&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;img alt="deep search" height="375" src="http://www.shellrevealed.com/photos/blog_images/images/7797/500x375.aspx" style="width:500px;height:375px;" title="deep search" width="500" /&gt;&lt;/p&gt;&lt;/font&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This Namespace simply generates 10 virtual items to a default depth of 5.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Search enumerates the contents of the Namespace to that depth.&lt;span&gt;&amp;nbsp; It should also be called out that we had to implement our namespace&amp;#39;s ParseDisplayName method in order for our namespace to function in the Search folder.&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Calibri" size="3"&gt;*Please note that the method described here only works with the &lt;/font&gt;&lt;a href="http://shellrevealed.com/blogs/shellblog/archive/2007/03/15/Shell-Namespace-Extension_3A00_-Creating-and-Using-the-System-Folder-View-Object.aspx"&gt;&lt;font face="Calibri" size="3"&gt;default shell view (Defview)&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;.&amp;nbsp; It is not supported for custom IShellView implementations.&lt;/font&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;font size="4"&gt;&lt;font face="Cambria"&gt;&lt;span style="color:#4f81bd;"&gt;Building the &lt;span class="spelle"&gt;FolderView SDK&lt;/span&gt;&amp;nbsp;Sample&lt;/span&gt;&lt;span style="font-size:18pt;line-height:115%;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/h2&gt;&lt;ol style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;To build the &lt;span class="spelle"&gt;FolderViewImpl&lt;/span&gt; sample, be sure to download and install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&amp;amp;DisplayLang=en" title="Windows SDK for Server 2k8"&gt;Windows SDK&lt;/a&gt;.&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;font face="Calibri"&gt;Download the modified &lt;/font&gt;&lt;font color="#0000ff" face="Calibri"&gt;&lt;a href="http://shellrevealed.com/files/folders/code_samples/entry7799.aspx" title="FolderViewImpl Sample Code"&gt;FolderView SDK&amp;nbsp;sample&lt;/a&gt;&lt;/font&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Launch FolderViewImpl.sln in Visual Studio (The solution file is for &lt;a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx" title="Visual Studio 2k8 Trial Download"&gt;Visual Studio&amp;nbsp;2008&lt;/a&gt;)&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Open the properties for the project &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Add a path to the SDK includes to the C/C++ - General page &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Add a path to the SDK &lt;span class="spelle"&gt;libs&lt;/span&gt; to the Linker &amp;ndash; General page &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Build&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;font size="4"&gt;&lt;font face="Cambria"&gt;&lt;span style="color:#4f81bd;"&gt;Installing the &lt;span class="spelle"&gt;FolderView SDK &lt;/span&gt;Sample&lt;/span&gt;&lt;span style="font-size:18pt;line-height:115%;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/h2&gt;&lt;ol style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Once you have built the sample, copy the FolderViewImpl.dll and &lt;span class="spelle"&gt;FolderViewImpl.propdesc&lt;/span&gt; to the same directory &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;From an elevated &lt;span class="spelle"&gt;cmd&lt;/span&gt; window, regsvr32 FolderViewImpl.dll &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Restart explorer &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;Open explorer to Computer &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size:10pt;"&gt;There should be a list item named &amp;ldquo;FolderView SDK Sample&amp;rdquo;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://shellrevealed.com/aggbug.aspx?PostID=7782" width="1" height="1"&gt;</content><author><name>chrdavis</name><uri>http://shellrevealed.com/members/chrdavis.aspx</uri></author><category term="API" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/API/default.aspx" /><category term="Coding" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Coding/default.aspx" /><category term="programming" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/programming/default.aspx" /><category term="Vista" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Vista/default.aspx" /><category term="Windows Vista" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Windows+Vista/default.aspx" /><category term="Search and Organize" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Search+and+Organize/default.aspx" /><category term="search" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/search/default.aspx" /><category term="shell" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/shell/default.aspx" /><category term="namespace" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/namespace/default.aspx" /><category term="extension" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/extension/default.aspx" /></entry><entry><title>Shell Namespace Extension: Adding Custom Command Module Items</title><link rel="alternate" type="text/html" href="http://shellrevealed.com/blogs/shellblog/archive/2007/09/05/Shell-Namespace-Extension_3A00_-Adding-Custom-Command-Module-Items.aspx" /><id>http://shellrevealed.com/blogs/shellblog/archive/2007/09/05/Shell-Namespace-Extension_3A00_-Adding-Custom-Command-Module-Items.aspx</id><published>2007-09-05T05:43:00Z</published><updated>2007-09-05T05:43:00Z</updated><content type="html">&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;color:#4f81bd;font-family:Cambria;"&gt;Overview&lt;/span&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;In my &lt;/span&gt;&lt;a href="http://shellrevealed.com/blogs/shellblog/archive/2007/03/15/Shell-Namespace-Extension_3A00_-Creating-and-Using-the-System-Folder-View-Object.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;earlier post&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;, I showed how to create a Shell Namespace Extension using the default IShellView implementation (also known as DefView).&lt;span&gt;&amp;nbsp; &lt;/span&gt;One thing you might have noticed from the sample is that the Commands Module is void of even the default items such as &amp;ldquo;Organize&amp;rdquo; and &amp;ldquo;Views&amp;rdquo;.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;img alt="Commands Module - FolderViewImpl" height="127" src="http://shellrevealed.com/photos/blog_images/images/7416/original.aspx" style="width:693px;height:127px;" title="Commands Module - FolderViewImpl" width="693" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;If you are developing your own Namespace and want to include the default buttons and/or add your own elements to the Commands Module as well, how do you accomplish this?&lt;span&gt;&amp;nbsp; &lt;/span&gt;The answer:&lt;span&gt; &amp;nbsp; &lt;/span&gt;you must implement the &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms645978.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IExplorerCommand&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;, &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms645970.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IExplorerCommandProvider&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt; and &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms646202.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IEnumExplorerCommand&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt; interfaces.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;Below I describe what each of the interfaces is used for and what you need to do to properly implement them in your code.&lt;/span&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;color:#4f81bd;font-family:Cambria;"&gt;IExplorerCommandProvider&lt;/span&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;After your Namespace is loaded, the Shell will ask your Namespace for an instance of an IExplorerCommandProvider (via your CreateViewObject implementation).&lt;span&gt;&amp;nbsp; &lt;/span&gt;This interface exposes two methods:&lt;span&gt;&amp;nbsp; &lt;/span&gt;GetCommand and GetCommands.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Shell calls the GetCommand method to retrieve a specific IExplorerCommand object that matches the supplied GUID (Each command is identified by a GUID).&lt;span&gt;&amp;nbsp; &lt;/span&gt;The GetCommands method is called to retrieve an IEnumExplorerCommand instance.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This object enumerates all the IExplorerCommand instances for the namespace.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;You Namespace is queried for its implementation of IExplorerCommandProvider via its IShellFolder&amp;#39;s implementation of CreateViewObject.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The REFIID passed to CreateViewObject will be IID_IExplorerCommandProvider.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Shell will then use this interface to retrieve your Commands Module items &amp;ndash; which are implementations of the &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms645978.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IExplorerCommand&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt; interface.&lt;/span&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;color:#4f81bd;font-family:Cambria;"&gt;IExplorerCommand&lt;/span&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The IExplorerCommand interface is used to provide the appearance and behavior of the item to Explorer&amp;rsquo;s Commands Module.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Most of the methods pass an IShellItemArray which identifies what items are currently selected in the view.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This information can be used by the implementation to customize the behavior for different selections or if no items are selected.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example, if no items are selected, you may wish to set the state to ECS_DISABLED or ECS_HIDDEN to grey-out or remove the item completely from the Commands Module, respectively.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The methods exposed by this interface are described below.&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding="0" cellspacing="0" class="MsoTableGrid" style="font-size:11pt;font-family:Calibri;border-collapse:collapse;border:medium none;"&gt;&lt;tr&gt;&lt;td style="padding-right:5.4pt;padding-left:5.4pt;background:#f79646;padding-bottom:0in;width:131.4pt;padding-top:0in;border:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;Method&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;Description&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;EnumSubCommands&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Returns an IEnumExplorerCommand instance used to enumerate sub commands of the current command.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Shell will only call this method if the GetFlags method returns ECF_HASSUBCOMMANDS .&lt;span&gt;&amp;nbsp; &lt;/span&gt;It is important to note here that while it is possible to do so, sub commands that have sub commands themselves are not encouraged.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetCanonicalName&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves the globally unique identifier (GUID) associated with this command&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetFlags&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves the flags associated with this command.&lt;span&gt;&amp;nbsp; &lt;/span&gt;These flags specify the appearance and behavior of the command on the Command Module.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetIcon&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves an icon resource string.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This string is in the form of &amp;ldquo;myfile.dll,id&amp;rdquo;.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example: &amp;ldquo;shell32.dll,-101&amp;rdquo;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetState&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves the state of the command item.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This is the first method of the interface that is called.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The state that is returned affects the appearance and behavior of the command item.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This method also passes a BOOL to let the command implementation know if the slow response rule is in effect. &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetTitle&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves the string to display for the command item.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;GetToolTip&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Retrieves the string to use in the ToolTip associated with this command item.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:black 1pt solid;width:131.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;Invoke&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#daeef3;padding-bottom:0in;border-left:#f0f0f0;width:347.4pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;span style="color:black;"&gt;Called by the Shell when the user has activated a command on the Commands Module.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;vertical-align:top;line-height:140%;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;The above methods GetState and GetFlags return values that determine the appearance and behavior of the item in the Command Module.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In the table below are screenshots of the command resulting from the combinations of the flags/states values.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding="0" cellspacing="0" class="MsoTableGrid" style="font-size:11pt;font-family:Calibri;border-collapse:collapse;border:medium none;"&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_ENABLED&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_DISABLED&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_HIDDEN&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;NONE&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7418/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7419/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7417/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASSUBCOMMANDS&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7424/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7423/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7417/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASSPLITBUTTON&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7426/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7427/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7417/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HIDELABEL&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7431/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7432/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7417/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_ISSEPARATOR&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;img height="97" src="http://shellrevealed.com/photos/blog_images/images/7436/original.aspx" width="135" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span&gt;&lt;span style="color:white;"&gt;N/A&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7424/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASLUASHIELD&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:78.5pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7437/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:80.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7438/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:73.7pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7417/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;table cellpadding="0" cellspacing="0" class="MsoTableGrid" style="font-size:11pt;font-family:Calibri;border-collapse:collapse;border:medium none;"&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_CHECKBOX&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#f79646;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_CHECKBOX|&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECS_CHECKED&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;NONE&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7418/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7418/original.aspx" style="width:111px;height:32px;" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASSUBCOMMANDS&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7424/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7422/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASSPLITBUTTON&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7428/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7429/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HIDELABEL&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7431/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="32" src="http://shellrevealed.com/photos/blog_images/images/7431/original.aspx" width="111" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_ISSEPARATOR&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span&gt;&lt;span style="color:white;"&gt;N/A&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:white;"&gt;N/A&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#8db3e2;padding-bottom:0in;border-left:black 1pt solid;width:126.25pt;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:left;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;ECF_HASLUASHIELD&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:84.15pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7440/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;padding-bottom:0in;border-left:#f0f0f0;width:36.05pt;padding-top:0in;border-bottom:black 1pt solid;background-color:transparent;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:black;"&gt;&lt;img height="83" src="http://shellrevealed.com/photos/blog_images/images/7441/original.aspx" width="144" /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:9pt;line-height:115%;"&gt;&lt;span style="font-family:Calibri;"&gt;*ECS_CHECKBOX and ECS_CHECKED only apply to sub items&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:9pt;line-height:115%;"&gt;&lt;span style="font-family:Calibri;"&gt;** ECF_ISSEPARATOR can only be added as a sub item&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;strong&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Slow Response Rule&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The second parameter of the GetState method is a BOOL (fOkToBeSlow) that lets the implementation of IExplorerCommand know if the &amp;ldquo;slow response rule&amp;rdquo; is in effect.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If this value is FALSE, and your implementation performs slow operations (such as I/O, network calls or calls to out of thread COM objects) then your command should return E_PENDING.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This will cause the Commands Module to call the command&amp;rsquo;s GetState (and other methods) on a background thread with fOkToBeSlow set to TRUE.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This prevents slow operations in your implementation from running on the UI thread, thus preventing performance issues.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;strong&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Command Item Ordering&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;It is important to note here that the developer of the Namespace Extension has no control over the ordering of command items.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example, you cannot force your command items before the default View and Organize command items or have the View or Organize command items renamed/removed.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Items are simply appended to the end of the Commands Module in the order returned from the IEnumExplorerCommand instance.&lt;/span&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;color:#4f81bd;font-family:Cambria;"&gt;IEnumExplorerCommand&lt;/span&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The IEnumExplorerCommand is returned to the Shell by the GetCommands method of the IExplorerCommandProvider interface.&lt;span&gt;&amp;nbsp; &lt;/span&gt;As the name suggests, it permits enumeration of the IExplorerCommand instances by the Shell.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;color:#4f81bd;font-family:Cambria;"&gt;FolderViewImpl Sample Code&lt;/span&gt;&lt;/h2&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The above interfaces have been implemented in the attached Shell Namespace Extension sample code derived from the FolderViewImpl SDK sample.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The structure of the command items (as well as sub items) is data-driven from an array of structures that define the command items (see the array of FVCOMMANDITEMs in fvcommands.cpp).&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;This approach was used to make it easy to experiment with the hierarchy of command items as well as their behavior/appearance.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;The way you implement commands in your Namespace Extension may differ.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;img alt="Commands Module - Modified FolderViewImpl" height="126" src="http://shellrevealed.com/photos/blog_images/images/7415/original.aspx" style="width:693px;height:126px;" title="Commands Module - Modified FolderViewImpl" width="693" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 10pt;text-align:center;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;The above is a screenshot of the modified SDK sample.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Notice we now have the default command items (Organize and Views) as well as our custom items.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Display command item performs the same function as right-clicking items in the view and selecting &amp;ldquo;Display&amp;rdquo; from the context menu.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Settings button is used to demonstrate a command item with sub items.&lt;span&gt;&amp;nbsp; &lt;/span&gt;All it does is display a message box with the name of the sub item when the user invokes the specified sub item.&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;It should also be noted that if you are using a custom view in your Namespace by implementing your own IShellView (instead of using DefView) you will need to include an implementation of IFolderView::GetFolder.&amp;nbsp; In your GetFolder implementation you will need to include the ability to QueryService for SID_SFolderView.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;"&gt;&lt;span style="color:#4f81bd;"&gt;&lt;span style="font-family:Cambria;"&gt;Building the &lt;span class="spelle"&gt;FolderView SDK&lt;/span&gt;&amp;nbsp;Sample&lt;span style="line-height:115%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;ol&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;To build the &lt;span class="spelle"&gt;FolderViewImpl&lt;/span&gt; sample, be sure to download and install the &lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=7614FE22-8A64-4DFB-AA0C-DB53035F40A0&amp;amp;displaylang=en"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;Windows SDK&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;.&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;Download the modified &lt;/span&gt;&lt;a href="http://shellrevealed.com/files/folders/7443/download.aspx"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;FolderView SDK&amp;nbsp;sample&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Launch FolderViewImpl.sln in Visual Studio &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Open the properties for the project &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Add a path to the SDK includes to the C/C++ - General page &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Add a path to the SDK &lt;span class="spelle"&gt;libs&lt;/span&gt; to the Linker &amp;ndash; General page &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Build&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 style="margin:10pt 0in 0pt;"&gt;&lt;span style="font-size:13pt;"&gt;&lt;span style="color:#4f81bd;"&gt;&lt;span style="font-family:Cambria;"&gt;Installing the &lt;span class="spelle"&gt;FolderView SDK &lt;/span&gt;Sample&lt;span style="line-height:115%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;ol&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Once you have built the sample, copy the FolderViewImpl.dll and &lt;span class="spelle"&gt;FolderViewImpl.propdesc&lt;/span&gt; to the same directory &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;From an elevated &lt;span class="spelle"&gt;cmd&lt;/span&gt; window, regsvr32 FolderViewImpl.dll &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Restart explorer &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Open explorer to Computer &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="font-family:Calibri;"&gt;There should be a list item named &amp;ldquo;FolderView SDK Sample&amp;rdquo;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src="http://shellrevealed.com/aggbug.aspx?PostID=7414" width="1" height="1"&gt;</content><author><name>chrdavis</name><uri>http://shellrevealed.com/members/chrdavis.aspx</uri></author><category term="API" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/API/default.aspx" /><category term="Coding" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Coding/default.aspx" /><category term="programming" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/programming/default.aspx" /><category term="Vista" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Vista/default.aspx" /><category term="Windows Vista" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/Windows+Vista/default.aspx" /><category term="shell" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/shell/default.aspx" /><category term="namespace" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/namespace/default.aspx" /></entry><entry><title>Vista Style Menus Part 2 – Custom menu drawing</title><link rel="alternate" type="text/html" href="http://shellrevealed.com/blogs/shellblog/archive/2007/05/09/Vista-Style-Menus-Part-2-_1320_-Custom-menu-drawing.aspx" /><id>http://shellrevealed.com/blogs/shellblog/archive/2007/05/09/Vista-Style-Menus-Part-2-_1320_-Custom-menu-drawing.aspx</id><published>2007-05-09T23:03:00Z</published><updated>2007-05-09T23:03:00Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://shellrevealed.com/blogs/shellblog/archive/2007/02/06/Vista-Style-Menus_2C00_-Part-1-_2D00_-Adding-icons-to-standard-menus.aspx"&gt;Part 1&lt;/a&gt; showed how to avoid owner draw menus by converting icons into bitmaps.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In Part 2 we will show how to use the Visual Style APIs in your owner draw code.&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Sample Custom Menu&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The &lt;a href="http://shellrevealed.com/files/folders/code_samples/entry7138.aspx" title="sample app" target="_blank"&gt;sample app&lt;/a&gt; demonstrates a simple custom behavior: A context menu that highlights the previously selected item.&amp;nbsp; This was inspired by the &amp;quot;recently installed&amp;quot; highlighting that the Start Menu does.&amp;nbsp; A dropdown menu lets you choose between standard menu rendering, owner draw with standard rendering, and owner draw using Visual Style APIs and the new Vista menu parts.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;text-align:center;"&gt;&lt;span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;strong&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Visual Style API Basics&lt;/h3&gt;&lt;/strong&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Before getting into the menu specifics there are a few concepts to touch on.&lt;span&gt;&amp;nbsp; &lt;/span&gt;A more complete discussion of the Visual Style API can be found &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/refentry.asp" title="here"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;ol style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;strong&gt;Theme handles (HTHEME.)&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;You call OpenThemeData() with your window handle and the visual class you are interested in (VSCLASS_MENU for our purposes.)&lt;span&gt;&amp;nbsp; &lt;/span&gt;You will get a NULL handle back if the current color scheme does not have visual styling enabled.&lt;span&gt;&amp;nbsp; &lt;/span&gt;You also need to watch WM_SETTINGCHANGE and regenerate your HTHEME.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If you do get back a NULL handle you will need to fall back to non-styled APIs to do your rendering.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;strong&gt;Theme parts and states.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;A visual element is made up of parts and each part may have multiple states.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example, a button has a background part and different states to differentiate between pressed and non-pressed states.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The sample code will show how to translate owner-draw fState flags into part and state IDs for menus.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Vssym32.h contains the part and state IDs for every visual class.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;strong&gt;Measurement.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;You inquire about the size or margins for a part / state pair using GetThemePartSize() and GetThemeMargins() respectively.&lt;span&gt;&amp;nbsp; &lt;/span&gt;You use GetThemeTextExtent() to measure text strings.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;strong&gt;Drawing.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/strong&gt;You can use DrawThemeBackground() and DrawThemeText() to render according to the current color scheme.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Overall structure of Sample App&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The MENUITEMDATA structure holds our owner draw data and the GetMenuItem() function returns a MENUITEM structure that contains all the info we need:&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;struct MENUITEM &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MENUITEMINFO&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mii;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MENUITEMDATA&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mid;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WCHAR&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;szItemText[256];&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The test app has a dropdown to switch between standard, owner draw, and owner draw using Visual APIs.&lt;span&gt;&amp;nbsp; &lt;/span&gt;To make this easier an interface is defined and two implementors of the interface are provided (CClassicOwnerDrawMenu and CVistaOwnerDrawMenu):&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;interface IOwnerDrawMenu&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual HRESULT Initialize(HWND hwndParent) = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual void MeasureItem(__in MENUITEM *pmi, __inout MEASUREITEMSTRUCT *pmis) = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual void DrawItem(__in MENUITEM *pmi, __in DRAWITEMSTRUCT *pdis) = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual void SelectedItem(int id) = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual HRESULT SettingChange() = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;virtual void Release() = 0;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The SelectedItem() method tells the class which item should receive special highlighting (The test app will call this with the previously selected menu item.)&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;CShellSimpleApp implements the outer shell of the program and is essentially a dialog box.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The WM_MEASUREITEM, WM_DRAWITEM, and WM_SETTINGCHANGE message handlers are the relevant portion of this class, along with the _SetMenuType() method which switches between menu types.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The remainder of this article will focus on CVistaOwnerDraw menu and it&amp;rsquo;s helper class CMenuMetrics.&lt;span&gt;&amp;nbsp; &lt;/span&gt;CClassicOwnerDraw is left as an exercise to the reader.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Modifying owner-draw code &amp;ndash; Initialization&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Before you are able to measure or draw with the Visual APIs you need an HTHEME and, as I said earlier, the user may not be using a color scheme that uses Visual APIs.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The Initialize method will attempt to get an HTHEME based on the parent window and return failure if no HTHEME is available.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The test harness will fall back to one of the other menu types in this case.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The heart of the initialization is done here (this is not the complete function, it&amp;rsquo;s been pared down for illustration):&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;HRESULT CMenuMetrics::Initialize()&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;HRESULT hr = E_FAIL;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;hTheme = OpenThemeData(hwndTheme, VSCLASS_MENU);&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (hTheme)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetThemePartSize(hTheme, NULL, MENU_POPUPCHECK, 0, NULL, TS_TRUE, &amp;amp;sizePopupCheck);&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetThemeInt(hTheme, MENU_POPUPITEM, 0, TMT_BORDERSIZE, &amp;amp;iPopupBorderSize); &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetThemeMargins(hTheme, NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &amp;amp;marPopupCheck); &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;hr = S_OK;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return hr;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;An HTHEME is requested from the parent window which maps to the menu class.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If it succeeds we then ask for the metrics we will need to properly measure and layout our menu items.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Modifying Owner-Draw code &amp;ndash; Measurement&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;There are several &amp;ldquo;Get&amp;rdquo; functions that return information on a part/state:&lt;/font&gt;&lt;/p&gt;&lt;ul style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;GetThemePartSize() will give you the dimensions of a part/state pair.&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;GetThemeMargins() will give you the spacing around a part/state pair.&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;GetThemeInt(&amp;hellip;, TMT_BORDERSIZE, &amp;hellip;) will give you the size of the border around a part/state pair&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;GetThemeTextExtent() will give you the dimensions of the text you specify using the correct font for the part/state pair.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The parameters are similar to the DrawText API, including a parameter that accepts DT_* flags.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;This information will enable you to make the appropriate measurement and layout calculations.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In the test app CMenuMetrics caches these metrics and provides some helper functions, like ToMeasureSize() which applies the specified margins to the tight bounding box you calculated for the menu item.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Modifying Owner-Draw code &amp;ndash; Drawing&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The first thing you need to do is convert the DRAWITEMSTRUCT&amp;rsquo;s itemState field into the correct state id (POPUPITEMSTATES for popup menus.)&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example, ODS_HOTLIGHT gets translated to MPI_HOT and ODS_INACTIVE can get translated to MPI_DISABLED.&lt;span&gt;&amp;nbsp; &lt;/span&gt;See CMenuMetrics::ToItemStateId() for details.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The next thing you do is layout the items according to the metrics you calculated during WM_MEASUREITEM and draw the menu in layers using DrawThemeBackground(), starting from the bottom layer:&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;ul style="margin-top:0in;"&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPBACKGROUND (if the background contains transparency)&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPGUTTER (if you want a gutter)&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPSEPARATOR (if the item is a separator)&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPITEM&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPCHECKBACKPGROUND (if you are rendering a checkmark)&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;MENU_POPUPCHECK (if you are rendering a checkmark)&lt;/font&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 0pt;tab-stops:list .5in;"&gt;&lt;font face="Times New Roman" size="3"&gt;DrawThemeText(&amp;hellip;, MENU_POPUPITEM, &amp;hellip;)&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;CVistaOwnerDraw::_DrawMenuItem() demonstrates this process.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Special considerations&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Allowing the test app to switch between owner-draw and non-owner draw menus presented an interesting issue: USER does not issue new WM_MEASUREITEM messages when the MFT_OWNERDRAW bit is toggled so it continues to use the old metrics.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This may be old news (it appears to have always worked this way) but it was a surprise to me.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Fortunately there is a simple workaround: make sure fMask has MIIM_BITMAP set when you call SetMenuItemInfo() and this will cause new WM_MEASUREITEM messages to be sent.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The ResetMenuMetrics() helper function will clear out all the menu items of the specified hmenu.&lt;span&gt;&amp;nbsp; &lt;/span&gt;A more efficient method would be to set this bit when flipping the MFT_OWNERDRAW bit but I wanted to call this out clearly in the sample code.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The MakeOwnerDraw() helper function is used by the test app to change between owner-draw and non-owner-draw.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Important details not covered in article&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The sample code presents a simplified version of menu rendering in order to explain the basic concepts.&lt;span&gt;&amp;nbsp; &lt;/span&gt;It does not use every part and state (no submenu rendering), it does not cover the menu bar, and it will not necessarily line up to the pixel with the system&amp;rsquo;s menu rendering.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If you are in the business of custom rendered menus then I don&amp;rsquo;t believe any of these simplifications will be an issue for you.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;At this point someone may say &amp;ldquo;Why didn&amp;rsquo;t you make an API that would render portions of the menu to make all this easier?&amp;rdquo;&lt;span&gt;&amp;nbsp; &lt;/span&gt;The answer to that is a familiar one: time and resources.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Vista was a big undertaking and we had plenty to do in order to get it wrapped up and out the door.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;h3 style="margin:12pt 0in 3pt;"&gt;Conclusion&lt;/h3&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The Visual Style APIs provide all the mechanisms needed to measure, layout and render many of our visual elements, and Vista added menu visuals with VSCLASS_MENU.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In spite of this owner-draw menus are still a significant amount of work to develop and maintain.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Now that Windows draws nicer looking menus, and there&amp;rsquo;s a way to get good looking icons with standard menus, I hope that the amount of owner-draw menu code reduces dramatically, leaving all of you with more time for innovation of your core products.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://shellrevealed.com/aggbug.aspx?PostID=7139" width="1" height="1"&gt;</content><author><name>ksykes</name><uri>http://shellrevealed.com/members/ksykes.aspx</uri></author><category term="vista style apis owner draw menus" scheme="http://shellrevealed.com/blogs/shellblog/archive/tags/vista+style+apis+owner+draw+menus/default.aspx" /></entry><entry><title>IFileOperation – Part 2: Using the IFileOperationProgressSink Interface</title><link rel="alternate" type="text/html" href="http://shellrevealed.com/blogs/shellblog/archive/2007/04/23/IFileOperation-_2D00_-Part-2_3A00_-Using-the-IFileOperationProgressSink-Interface.aspx" /><id>http://shellrevealed.com/blogs/shellblog/archive/2007/04/23/IFileOperation-_2D00_-Part-2_3A00_-Using-the-IFileOperationProgressSink-Interface.aspx</id><published>2007-04-23T16:47:00Z</published><updated>2007-04-23T16:47:00Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;strong&gt;&lt;span style="font-size:16pt;line-height:115%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;In the &lt;/span&gt;&lt;a href="http://shellrevealed.com/blogs/shellblog/archive/2007/04/16/IFileOperation-_1320_-Part-1_3A00_-Introduction.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;first part of my posts for the IFileOperation interface&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;, I wanted to give an overview of what it is used for and leave the real meat for later.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Now it&amp;rsquo;s time for the fun stuff.&lt;span&gt;&amp;nbsp; &lt;/span&gt;In this post I want to dig into the use of the &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms645572.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IFileOperationProgressSink&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;.&lt;span&gt; &amp;nbsp; &lt;/span&gt;In the MSDN docs for &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms645747.aspx"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;IFileOperation&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;, you will notice that some of the methods take an instance of this interface as a parameter.&lt;span&gt;&amp;nbsp; &lt;/span&gt;What is this interface and what is it used for?&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The IFileOperationProgressSink was created to provide a rich notification system for callers who want to know the details of the operation they are performing.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This was a common request of developers who were using the old SHFileOperation API, with which this was simply not possible.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The only feedback mechanism used with SHFileOperation was the rarely used &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/structures/shnamemapping.asp"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;SHNAMEMAPPING&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt; structure &amp;ndash; a source of many headaches for developers.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The below table highlights the methods you must implement for &lt;strong&gt;IFileOperationProgressSink&lt;/strong&gt;:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding="0" cellspacing="0" class="MsoTableGrid" style="font-size:11pt;font-family:Calibri;border-collapse:collapse;border:medium none;"&gt;&lt;tr&gt;&lt;td style="padding-right:5.4pt;padding-left:5.4pt;background:#984806;padding-bottom:0in;width:1.7in;padding-top:0in;border:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:white;"&gt;Method&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#984806;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:white;"&gt;Description&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;StartOperations&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when the operation has begun&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;FinishOperations&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when the operation has completed&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;UpdateProgress&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when progress of operation is updated (total items involved in the operation and total items completed so far)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PauseTimer&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when the progress timer is paused (currently not used)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;height:19px;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;ResetTimer&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;height:19px;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when the progress timer is reset (currently not used)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;ResumeTimer&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called when the progress timer is resumed (currently not used)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;height:19px;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PreCopyItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;height:19px;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called before a copy operation begins for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PostCopyItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called after a copy operation completes for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PreDeleteItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called before a delete operation begins for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PostDeleteItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called after a delete operation completes for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PreRenameItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called before a rename operation begins for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PostRenameItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called after a rename operation completes for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PreMoveItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called before a move operation begins for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PostMoveItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called after a move operation completes for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PreNewItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called before a new operation begins for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;PostNewItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Called after a new operation completes for an item&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;Not only can you get notified of the beginning, end, and overall progress of the entire operation, but you can listen for details of each item involved in the operation.&lt;span&gt;&amp;nbsp; &lt;/span&gt;These details include (depending on the operation type): source and destination, new name in the destination, operation flags associated with the operation, as well as the resulting HRESULT of that particular operation.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This allows developers to know the specific point where an operation failed.&lt;span&gt; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 style="margin:24pt 0in 0pt;"&gt;&lt;span style="font-size:14pt;font-family:Cambria;"&gt;Using the IFileOperationProgressSink &lt;/span&gt;&lt;/h1&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The IFileOperation interface provides multiple methods which take an instance of an IFileOperationProgressSink as a parameter.&lt;span&gt;&amp;nbsp; &lt;/span&gt;To be notified of all progress notifications from the copy engine, you should call IFileOperation::Advise which takes an IFileOperationProgressSink instance and produces a cookie that identifies the sink which can be used in a subsequent call to IFileOperation::Unadvise to remove the sink.&lt;span&gt;&amp;nbsp; &lt;/span&gt;If all you are interested in is a particular component of an operation, you can specify the IFileOperationProgressSink instance in call to one of the specific IFileOperation operation methods listed in the table below.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;strong&gt;IFileOperation&lt;/strong&gt; methods that take an IFileOperationProgressSink:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;table cellpadding="0" cellspacing="0" class="MsoTableGrid" style="font-size:11pt;color:#000000;font-family:Calibri;border-collapse:collapse;border:medium none;"&gt;&lt;tr&gt;&lt;td style="padding-right:5.4pt;padding-left:5.4pt;background:#984806;padding-bottom:0in;width:1.7in;padding-top:0in;border:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:white;"&gt;Method&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:black 1pt solid;padding-left:5.4pt;background:#984806;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p align="center" class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;text-align:center;"&gt;&lt;strong&gt;&lt;span style="color:white;"&gt;Description&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Advise&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;Sets the IFileOperationProgressSink implementation to be called into for all sink notifications.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The caller must call Unadvise to remove the sink.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;CopyItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;The IFileOperationProgressSink is called into for PreCopyItem and PostCopyItem sink notifications for this operation only.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;MoveItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;The IFileOperationProgressSink is called into for PreMoveItem and PostMoveItem sink notifications for this operation only.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;RenameItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;The IFileOperationProgressSink is called into for PreRenameItem and PostRenameItem sink notifications for this operation only.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;DeleteItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;The IFileOperationProgressSink is called into for PreDeleteItem and PostDeleteItem sink notifications for this operation only.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color:#000000;"&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:black 1pt solid;width:1.7in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;NewItem&lt;/p&gt;&lt;/td&gt;&lt;td style="border-right:black 1pt solid;padding-right:5.4pt;border-top:#f0f0f0;padding-left:5.4pt;background:#fde9d9;padding-bottom:0in;border-left:#f0f0f0;width:4.95in;padding-top:0in;border-bottom:black 1pt solid;"&gt;&lt;p class="MsoNormal" style="margin:0in 0in 0pt;line-height:normal;"&gt;The IFileOperationProgressSink is called into for PreNewItem and PostNewItem sink notifications for this operation only.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0in 0in 10pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;* If you add your sink in a call to both Advise and any of the other previously mentioned methods, you will receive duplicate progress sink notifications.&lt;/span&gt;&lt;/p&gt;&lt;h1 style="margin:24pt 0in 0pt;"&gt;&lt;span style="font-size:14pt;font-family:Cambria;"&gt;Documentation Corrections&lt;/span&gt;&lt;/h1&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;At the time of this writing the documentation for this interface on MSDN was not accurate.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The documentation writers have been notified and are making the necessary corrections.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The below methods are NOT INCLUDED in the IFileOperationProgressSink interface:&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;em&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;PreLinkItem&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;em&gt;&lt;span style="font-size:11pt;"&gt;&lt;span style="font-family:Calibri;"&gt;PostLinkItem&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 style="margin:24pt 0in 0pt;"&gt;&lt;span style="font-size:14pt;font-family:Cambria;"&gt;Building the IFileOperationProgressSink sample&lt;/span&gt;&lt;/h1&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;The included sample code shows how to implement the IFileOperationProgressSink and use it with IFileOperation.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For simplification, the sample only performs a copy operation with the given source and destination paths and responds only to StartOperations, FinishOperations, UpdateProgress, PreCopyItem, and PostCopyItem.&lt;span&gt;&amp;nbsp; &lt;/span&gt;You can extend the code provided in the sample if you wish.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNoSpacing" style="margin:0in 0in 0pt;"&gt;&lt;span style="font-size:11pt;font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;Download and install the &lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=7614FE22-8A64-4DFB-AA0C-DB53035F40A0&amp;amp;displaylang=en"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;Windows SDK&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;.&amp;nbsp; &lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-size:10pt;font-family:Calibri;"&gt;Download the &lt;a href="http://shellrevealed.com/files/folders/code_samples/entry7088.aspx"&gt;IFileOperationProgressSink_Sample&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span style="font-size:10pt;"&gt;Launch FileOperationProgressSinkSample.sln in Visual Studio&lt;/span&gt;&lt;span style="font-size:10pt;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span style="font-size:10pt;"&gt;Open the properties for the project&lt;/span&gt;&lt;span style="font-size:10pt;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span style="font-size:10pt;"&gt;Add a path to the SDK includes to the C/C++ - General page&lt;/span&gt;&lt;span style="font-size:10pt;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin:0in 0in 10pt;line-height:normal;tab-stops:list .5in;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span style="font-size:10pt;"&gt;Add a path to the SDK &lt;span class="spelle"&gt;libs&lt;/span&gt; to the Linker &amp;ndash; General page&lt;/span&gt;&lt;span st