Welcome to MSDN Blogs Sign in | Join | Help

Preview Handler Association Editor

I received an email from MSDN Magazine subscriber Oren Novotny thanking me for my preview handler article in the January 2007 issue of MSDN Magazine.  Oren also wondered whether a tool could be written to make it easy to edit preview handler registrations for particular extensions.  For example, what if you wanted to associate the Microsoft Windows TXT Preview Handler with .reg or .h files so that those would be previewable, where they're not by default.  Or what if you had two different preview handlers for XML files and you wanted to be able to easily switch back and forth between them with relative ease.

As an answer to this, I threw together a Preview Handler Association Editor tool.  When the app loads, it looks to the registry for all registered preview handlers.  It then loops through all classes and extensions in HKCR to see if each has a preview handler registered, and if it does, which.  Once that data is loaded (which on my machine takes approximately a second), the interface displays a combobox allowing you to pick any of the registered preview handlers.  The listbox with checkboxes of classes and extensions is then refreshed to show all of the classes/extensions; those associated with the selected preview handler will be checked.  Checking items that aren't checked causes them to be immediately associated with the selected preview handler, and unchecking checked items causes them to be immediately unregistered for the selected preview handler.  You can also check the "Only show classes associated with this handler" check box to filter down the list to make it easier to see all of the extensions/classes currently associated with the selected handler. This tools is provided "as is" with no warranties and confers no rights. It's covered by the Microsoft Permissive License.

Published Thursday, December 14, 2006 7:57 AM by MSDNMagazine
Filed under: ,

Attachment(s): PreviewHandlerEditor.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, December 14, 2006 2:27 PM by SGriffin's [MSFT] WebLog

# Preview Handlers in Outlook 2007

I figure it won't be long before folks are asking me how to do this. Stephen Toub put up a great article

Thursday, December 14, 2006 2:53 PM by onovotny

# re: Preview Handler Association Editor

Thanks, it looks great and works really well.

--Oren

Thursday, January 04, 2007 4:30 PM by Rodrigo

# re: Preview Handler Association Editor

Hi.

There is somehow to associate html files with some PreviewHandler? Outlook 2007 is lacking a html PreviewHandler, thats weird.

tnx.

PS.: I got a error after associate .htm with MSDN Internet Explorer Preview Handler using this editor.

Thursday, January 04, 2007 4:32 PM by toub

# re: Preview Handler Association Editor

Are you using RTM of Outlook 2007 on Vista RTM?  It does have a built-in HTML preview handler.

Thursday, January 04, 2007 7:34 PM by MSDN Magazine

# Vista and Office: View Data Your Way With Our Managed Preview Handler Framework

The new Windows Vista preview pane lets you preview files right within the shell, and Outlook 2007 gives

Friday, January 26, 2007 9:35 PM by Chris Pietschmann

# re: Preview Handler Association Editor

Could you post the source code for this editor?

It seems to error everytime I try to run it. I am running Vista x64 RTM by the way.

Friday, February 02, 2007 11:02 AM by Brian Kudera

# re: Preview Handler Association Editor

Thanks for sharing this handy utility!

However, when I run the application I do not have the Registered Handler of Microsoft Windows TXT Preview Handler. How do I add this as a handler?

Friday, February 02, 2007 1:57 PM by Stephen Toub

# Code for PreviewHandlerAssociationEditor

I've had several requests for the code for the PreviewHandlerAssociationEditor tool I put up a few weeks

Friday, February 02, 2007 1:59 PM by toub

# re: Preview Handler Association Editor

Chris, I've updated the download with the source for the tool.  If you figure out why it's not working for you on x64, I'd be very interested in the answer.  I unfortunately don't have an x64 machine accessible to me at the moment to test it on.

Brian, what handlers do show up in the combobox?  Are any available?

Friday, February 02, 2007 3:19 PM by briankudera

# re: Preview Handler Association Editor

I have the following Registered Handles displaying in the utility:

Microsoft Office Excel previewer

Microsoft Office PowerPoint previewer

Microsoft Office Visio previewer

Microsoft Office Word previewer

FYI I am on Win XP Pro

Friday, February 02, 2007 7:24 PM by toub

# re: Preview Handler Association Editor

Ah! Yeah, there are differences between Windows Vista and WinXP.  I tried to make it clear in the article, but obviously I could have made it clearer ;)  Vista ships with some preview handlers, as does Office 2007, and the sets they ship with are different.  I believe the TXT preview handler is just in the Vista subset, which would explain why it's not available to you.

Saturday, February 03, 2007 12:40 AM by briankudera

# re: Preview Handler Association Editor

ahh ha toub- that probably explains it!

Sorry, didn't catch that as the description of this thread. I'll locate another thread to post my WinXP Pro issues on.

Thanks!!

Brian

Wednesday, February 07, 2007 2:32 AM by Sergio Tarrillo's Blog -> enhancements

# Creando Previewers Personalizados para Outlook 2007

Los que tienen Office 2007, o probaron las Betas de Office 2007, se pudieron dar cuenta de una excelente...

Wednesday, February 07, 2007 2:32 AM by SergioTarrillo's RichWeblog

# Creando Previewers Personalizados para Outlook 2007

Los que tienen Office 2007, o probaron las Betas de Office 2007, se pudieron dar cuenta de una excelente

Friday, February 16, 2007 12:14 AM by Stephen Toub

# Update to PreviewHandlerAssociationEditor for Vista x64

John Robbins emailed me tonight to let me know that he found a bug with my PreviewHandlerAssociatedEditor

Monday, March 12, 2007 11:56 PM by Helio

# re: Preview Handler Association Editor

This is great - however it crashes when I try to add XML to the TXT handler.

Tuesday, March 13, 2007 12:31 AM by toub

# re: Preview Handler Association Editor

Helio, what crashes?

Tuesday, March 13, 2007 2:14 AM by helio

# re: Preview Handler Association Editor

Sorry I misstated really - I get an unhandled exception the gist of it is this:

System.UnauthorizedAccessException: Access to the registry key 'HKEY_CLASSES_ROOT\XML' is denied.

But the app doesn't crash. However, nor does it create the handler association. I tried running as admin...

Tuesday, March 13, 2007 12:06 PM by toub

# re: Preview Handler Association Editor

You're selecting the wrong item in the list.  You want ".xml", not "xml".

Saturday, March 17, 2007 8:27 AM by Wouter Baake

# re: Preview Handler Association Editor

Is there any reason why HTML preview is not supported with Outlook 2007 on Win XP Pro?

These kind of stupid things are driving me crazy, there's HTML rendering for messages, but not for attachment previewing, what the hell is that...

Friday, March 30, 2007 5:16 AM by Quartz

# Photoshop Preview Handler

I have created a Photoshop preview handler based on your brilliant framework and article on MSDN jan 2007

Photoshop files(PSD) Preview Handler for Windows Vista here

http://www.codeproject.com/useritems/PhotoshopPreviewHandler.asp

Do let me know what you think about that

Friday, March 30, 2007 5:57 PM by toub

# re: Preview Handler Association Editor

Quartz, that's awesome!  I'm glad to see that folks like you are picking this up and running with it to create new preview handlers.  I hope the framework was helpful, and please do let me know of any others you create.

Tuesday, May 01, 2007 12:28 PM by Somnath Mondal

# re: Preview Handler Association Editor

Is it possible to use the file previewer component which already installed with Outlook 2007 using C# Windows Form. Basically I want to preview office document inside my application window. It will help me a lot if you send some article/link on the same

Tuesday, May 01, 2007 1:59 PM by toub

# re: Preview Handler Association Editor

It should be possible, but I've never tried.  Good luck.

Tuesday, June 19, 2007 6:25 PM by orimarjr69@gmail.com

# re: Preview Handler Association Editor

i have been looking for a dwg. handler for auto cad for almost a week with no success i am not a programmer but have a feeling by the time i find it i would have already written on myself lol. Every architect and engineer could use this but so far does not exist can any body please point me in at least a general direction i which i should be surfing!

Thursday, July 26, 2007 5:13 PM by Coding Powers

# Hosting Vista File Previews in Managed Code

As part of my work on the Coding4Fun Developer Kit 2008, I created a WinForm control encapsulating the...

Tuesday, July 31, 2007 7:34 PM by Geoff

# re: Preview Handler Association Editor

I agree with Wouter Baake  why cant i preview a html attachment in outlook 2007 - this seems really crazy!!!

Monday, October 01, 2007 3:45 PM by Dane

# re: Preview Handler Association Editor

Thanks.

.Divx now previews in Vista.

Regards

Dane

Wednesday, October 31, 2007 7:03 AM by Wimmme

# re: Preview Handler Association Editor

For PreviewHandlers on XP, look at http://www.azarfamily.org/previewhandlersforwindowsxp

GIl Azar did an amazing job there !

Friday, November 30, 2007 5:21 AM by Colin Walker

# re: Preview Handler Association Editor

Resolved some issues I was having really easily. Thanks :)

Monday, December 24, 2007 12:09 AM by Robert McLaws

# re: Preview Handler Association Editor

Does this code work on Vista x64?

Saturday, December 29, 2007 11:36 AM by toub

# re: Preview Handler Association Editor

Sunday, December 30, 2007 10:25 PM by Robert McLaws: Windows Vista Edition

# Vista & Office 2007 Preview Handlers

One of the cooler Vista features that I've started using more often is the File Preview in Windows Explorer.

Sunday, December 30, 2007 10:26 PM by Robert McLaws: Windows Vista Edition

# Vista & Office 2007 Preview Handlers

One of the cooler Vista features that I've started using more often is the File Preview in Windows Explorer.

Thursday, January 17, 2008 8:34 AM by msapc

# re: Preview Handler Association Editor

Thank you for a good program! Already helped me fix some problems after installing one of those handler packs for WinXP.

One wish - If You could please make some substring search in the extension list, because otherwise looking for the desired filetype is pretty lengthy process.

Wthat I want is "search" field, where I could enter "pd" (case insensitive) and see only ".*PD.*" stuff, including those long names like "Adobe PDF File" along with simple ".pdf" lines.

Tuesday, March 11, 2008 1:48 AM by Shahed Khan (MVP C#)

# The Big Ten Life and Work Changing Utilities from Scott Hanselmans BLOG

Saturday, March 22, 2008 8:56 AM by Ramesh

# re: Preview Handler Association Editor

Another tool here...released in the same month as Preview Handler Association Editor.

[PreviewConfig]

http://www.winhelponline.com/articles/114/1/PreviewConfig-Utility-to-register-file-types-for-Explorer-Preview-Pane-in-Windows-Vista.html

Thursday, March 27, 2008 3:02 AM by kenzy

# re: Preview Handler Association Editor

How about the .rar type files ? I can't find it after installed winrar. No prog handler found

Friday, April 04, 2008 6:54 AM by John Smith

# Preview Handler blocking Excel

If I preview an Excel file, an instance of Excel.exe is opened that stays open. This prevents me from double clicking an Excel file because the excel.exe that is already running causes Excel to report that Personal.xlsb is in use, so my macros are not available.

The only way I can use Excel freely is to shut down Explorer after previewing, to kill that first instance of excel.exe, then open Excel, then do File, Open and navigate to the file. Hardly practical!

Could you suggest a solution?

Wednesday, June 04, 2008 1:20 PM by Amirz

# re: Preview Handler Association Editor

the tool detects only registered preview handler that already exists. Can it add new ones? eg for dwg. thanks

Thursday, July 17, 2008 10:37 AM by SGriffin's [MSFT] WebLog

# Preview Handlers in Outlook 2007

I figure it won't be long before folks are asking me how to do this. Stephen Toub put up a great article

Tuesday, December 09, 2008 6:47 PM by PeteGoo's Blog

# Preview Handlers for Vista and Outlook 2007

Preview Handlers for Vista and Outlook 2007

Thursday, December 11, 2008 8:15 AM by adobe premiere elements tryout serial

# re: Preview Handler Association Editor

adobe premiere elements tryout serial [URL=http://fokrdarc.ifrance.com/20081130-adobe-premiere.htm]adobe premiere elements tryout serial[/URL] [url=http://fokrdarc.ifrance.com/20081130-adobe-premiere.htm]adobe premiere elements tryout serial[/url] [url]http://fokrdarc.ifrance.com/20081130-adobe-premiere.htm[/url]

Friday, January 02, 2009 7:54 PM by newbie

# Preview Handler for image files?

I'm testing out this and the excellent handler framework, and I've come across an issue/question. I can't seem to get jpg/gif/bmp files to preview properly in the code i'm writing, though other file types (office, pdf, etc.) work fine as in the example code. Jpg/Gif/Bmp files preview just fine in the Vista explorer preview pane, so I don't think there's any issue in my registry, etc., but I can't find out what previewer is used for them (none shows in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers).

Any thoughts or guidance on this would be much appreciated!

Thursday, January 15, 2009 7:28 PM by Florida SEO

# Preview Handler Association Editor

Stephen ... I want to thank you for your excellent contribution to everyone with the fantastic tool ...

I do a lot of web development work and it is fantastic to be able to preview code automatically without having to open up my preferred text editor to view the files (EditPad Pro):) ...

Thank you very much ...

Edward Beckett

Friday, April 10, 2009 6:39 PM by Rudy

# re: Preview Handler Association Editor

I can't download this tool! (404) Please fix it thanx

Friday, April 10, 2009 7:36 PM by toub

# re: Preview Handler Association Editor

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker