How to disable preview handler for a given file path

909 views Asked by At

I am writing an applications in C# and thought to working with PreviewHandler for Windows. I have just started to work with Windows Explorer and Preview Handler so don't know what to do and where to start. Frankly don't have any idea how does it work, so any guidance would be helpful.

The requirement is to disable the file\folder preview for a given file path. Suppose I have been shared a filePath C:\User\abcd\MyDocuments\Pictures and in this folder there are 10 files then by default Windows shows the preview of the files. Our requirement is to disable file preview.

Can this be done? If so can anybody guide me how can I achieve that?

It may be that for a given file extension we want to disable the preview. Like for .png file but not for .pdf file.

Any guidance please.

[EDIT]

Let me rephrases my question. How to provide a custom preview for files in Preview pane? Suppose I want to display a image file in the preview pane based upon some condition, can I do that? Can I put some conditions in my own code so that preview does/does not appear in certain cases.

Thanks Deb

1

There are 1 answers

0
burgua On

It's possible to change Overview/Thumbnail for all files with specified extension using ShellExtensions. You can do it with SharpShell (http://sharpshell.codeplex.com)

It seems to me, that it's impossible to do it in right way. You can implement IInitializeWithFile for IThumbnailProvider and for every file outside given path return Thumbnail with ShellFile (http://blogs.msdn.com/b/windowssdk/archive/2009/06/12/windows-api-code-pack-for-microsoft-net-framework.aspx).

But it looks really tricky