mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-21 07:17:56 +08:00
f5325f025c
Signed-off-by: ACGMN <ootopoo@vip.qq.com> |
||
---|---|---|
.. | ||
common | ||
GcodePreviewHandler | ||
GcodePreviewHandlerCpp | ||
GcodeThumbnailProvider | ||
GcodeThumbnailProviderCpp | ||
MarkdownPreviewHandler | ||
MarkdownPreviewHandlerCpp | ||
MonacoPreviewHandler | ||
MonacoPreviewHandlerCpp | ||
PdfPreviewHandler | ||
PdfPreviewHandlerCpp | ||
PdfThumbnailProvider | ||
PdfThumbnailProviderCpp | ||
powerpreview | ||
StlThumbnailProvider | ||
StlThumbnailProviderCpp | ||
SvgPreviewHandler | ||
SvgPreviewHandlerCpp | ||
SvgThumbnailProvider | ||
SvgThumbnailProviderCpp | ||
UnitTests-GcodePreviewHandler | ||
UnitTests-GcodeThumbnailProvider | ||
UnitTests-MarkdownPreviewHandler | ||
UnitTests-PdfPreviewHandler | ||
UnitTests-PdfThumbnailProvider | ||
UnitTests-PreviewHandlerCommon | ||
UnitTests-StlThumbnailProvider | ||
UnitTests-SvgPreviewHandler | ||
UnitTests-SvgThumbnailProvider | ||
README.md | ||
STATestClassAttribute.cs | ||
STATestMethodAttribute.cs |
File Explorer
End user facing:
Developing
- Add new C++ DLL project in the preview pane folder. This DLL is actual preview handler, i.e. implements IPreviewHandler/IThumbnailProvider interface.
- Add new .NET EXE project in the preview pane folder. This EXE is being spawned by C++ DLL to generate preview/thumbnail.
Installation
MSI (Recommended)
To add a new Previewer update the Product.wxs
file in PowerToysSetup
similar to existing Previewer to register the Preview Handler. More details about registration of Preview Handlers can be found here. - implemented in modulesRegistry.h.
Directly registering/unregistering DLL's
[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.
Registering Preview Handler
- Restart Visual studio as administrator.
- Sign
XYZPreviewHandler
and it's dependencies. To sign an assembly in VS, follow steps given here. - Build
XYZPreviewHandler
project. - Open developer command prompt from
Tools > Command Line > Developer Command Prompt
. - Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC).
gacutil -i <path to dependency>
- Run following commands to register preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
gacutil -i <path to XYZPreviewHandler.dll>
RegAsm.exe /codebase <path to XYZPreviewHandler.dll>
- Restart Windows Explorer process.
Unregistering Preview Handler
- Run following commands in elevated developer command prompt to unregister preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
RegAsm.exe /unregister <path to XYZPreviewHandler.dll>
gacutil -u XYZPreviewHandler
Debugging
Since in-process preview handlers run under a surrogate hosting process (prevhost.exe by default), to debug a preview handler, you need to attach the debugger to the host process.
- Click on a file with registered extension to start host process.
- Attach debugger in Visual studio from
Debug->Attach to Process
and selectprevhost.exe
with typeManaged(version), x64
.
Managing Preview Handlers
After successful integration, your preview handler should appear in the PowerToys settings UI under the File Explorer Preview
Tab. In here you should be able to enable and disable all the preview handles.