Shell Extension Samples
Thumbnail providers and preview handlers extend the core functionality of Windows shell.
They are different from most of the Code Pack because shell calls into your code, rather than your code calling into shell.
In order for shell to know that it needs to look for your code and find it, you must register your compiled assemblies.
To register your handlers.
1. Derive your class from IPreviewHandler, or IThumbnailProvider and one or more initialization interfaces.
2. Add the correct attributes to your handler class.
Both Preview handlers and Thumbnail providers require these attributes.
[ComVisible(true)] // Lets Shell/COM see your class
[ClassInterface(ClassInterfaceType.None)] // Required
[ProgId("HandlerSamples.XYZPreviewerWPF")] // This is required for associating the surrogate host, it should be unique per handler.
[Guid("B9E6A036-9778-4B48-BA45-33F15B9B07AF")] // This is the GUID under which the assembly is registered; it must be unique.
Preview handlers require this additional attribute:
[PreviewHandler("PreviewHandlerWPFDemo", ".xyz", "{EC3E84CC-BDC5-4E9F-A67F-CC960F366497}")] // Name, Semi-colon-separated list of extensions and handler ID (must be unique).
Thumbnail handlers require this additional attribute.
[ThumbnailProvider("XYZThumbnailer", ".xyz", DisableProcessIsolation = false)] // Name, Semi-colon-separated list of file extensions. DisableProcessIsolation is only required if IThumbnailFromStream is not implemented.
3. Compile. Make sure you compile specifically for the OS version of your system.
On 64-bit OS, build for x64.
On 32-bit OS, build for x86.
4. Navigate to the output directory in the Visual Studio command prompt.
Make sure to use the correct prompt for your OS type (32/64 bit).
5. Register your assembly using the following command, make sure to verify there were no errors.
If errors have occurred, you will need to recompile your assembly and register again.
regasm /codebase "<assemblyname>"
Notes:
- Once your assembly has been registered successfully, if it is in use by the Shell you cannot rebuild your assembly because the file is locked.
You can either terminate the surrogate host process for the handler before rebuilding, or restart the explorer process before rebuilding.
- Thumbnails generated by the thumbnail provider are cached. They are regenerated for significantly different sizes.
A cached thumbnail will be added/updated if there is no thumbnail of that or larger size, or if the file has been modified.
To clear the cache, use the Disk Cleanup Utility and check the "Thumbnails" option.
- To unregister an assembly, make sure the GUID is the same as originally registered, then use "regasm /unregister <assembly>".
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Windows 7应用程序开发包及示例代码(Visual Studio 2010 + C#) - 示例代码 (997个子文件)
ExplorerBrowserTestWindow.baml 15KB
Window1.baml 13KB
AdvancedSearch.baml 9KB
Generic.baml 9KB
Window1.baml 6KB
Window1.baml 6KB
commandlinkwpf.baml 5KB
Window1.baml 4KB
Window1.baml 4KB
Window1.baml 4KB
StartBackupPage.baml 2KB
BackupProcessPage.baml 2KB
Window1.baml 2KB
Window1.baml 2KB
StarBackupMain.baml 2KB
MainWindow.baml 2KB
Window1.baml 2KB
RatingControl.baml 2KB
RatingControl.baml 2KB
WpfPreviewHandlerDemoControl.baml 2KB
DragAndDropWindow.baml 1KB
Window1.baml 1KB
MainWindow.baml 690B
WizardDialogBox.baml 671B
ResolveAssemblyReference.cache 18KB
ResolveAssemblyReference.cache 14KB
ResolveAssemblyReference.cache 14KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 7KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
DesignTimeResolveAssemblyReferencesInput.cache 6KB
ResolveAssemblyReference.cache 5KB
StarBackup_MarkupCompile.cache 514B
KnownFoldersBrowser_MarkupCompile.cache 441B
SearchApp_MarkupCompile.cache 439B
PicturePropertiesEditor_MarkupCompile.cache 436B
WPFExplorerBrowserDemo_MarkupCompile.cache 414B
CustomFileDialogsDemo_MarkupCompile.cache 410B
StockIconsDemo_MarkupCompile.cache 405B
ImageViewerDemo_MarkupCompile.cache 402B
PowerMgmtDemoApp_MarkupCompile.cache 394B
WPFDND_MarkupCompile.cache 393B
ShellObjectWatcherSampleWPF_MarkupCompile.cache 386B
ShellHierarchyTreeDemo_MarkupCompile.cache 368B
NetworkDemo_MarkupCompile.cache 349B
WpfGlassDemo_MarkupCompile.cache 336B
HandlerSamples_MarkupCompile.cache 279B
HandlerSamples_MarkupCompile.i.cache 279B
SearchApp.exe.config 937B
SearchApp.vshost.exe.config 937B
app.config 937B
TaskbarDemoMainForm.Designer.cs 32KB
Form1.cs 29KB
AdvancedSearch.xaml.cs 26KB
ExplorerBrowserTestForm.Designer.cs 25KB
Transliterator.Designer.cs 21KB
Form1.cs 21KB
Window1.xaml.cs 21KB
Program.cs 20KB
Form1.Designer.cs 19KB
Form1.Designer.cs 18KB
TaskbarDemoMainForm.cs 17KB
TestHarness.Designer.cs 16KB
ChildDocument.Designer.cs 15KB
ThumbnailBrowser.cs 15KB
ExplorerBrowserTestWindow.g.cs 15KB
AdvancedSearch.g.cs 15KB
ThumbnailBrowser.Designer.cs 13KB
Form1.cs 13KB
Window1.xaml.cs 12KB
ExplorerBrowserTestForm.cs 12KB
Transliterator.cs 12KB
Window1.xaml.cs 11KB
共 997 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
hlj493595708
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功