Freigeben über


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.

PreviewHandlerEditor.zip

Comments

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

  • Anonymous
    December 14, 2006
    Thanks, it looks great and works really well. --Oren

  • Anonymous
    January 04, 2007
    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.

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

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

  • Anonymous
    January 26, 2007
    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.

  • Anonymous
    February 02, 2007
    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?

  • Anonymous
    February 02, 2007
    I've had several requests for the code for the PreviewHandlerAssociationEditor tool I put up a few weeks

  • Anonymous
    February 02, 2007
    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?

  • Anonymous
    February 02, 2007
    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

  • Anonymous
    February 02, 2007
    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.

  • Anonymous
    February 02, 2007
    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

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

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

  • Anonymous
    February 15, 2007
    John Robbins emailed me tonight to let me know that he found a bug with my PreviewHandlerAssociatedEditor

  • Anonymous
    March 12, 2007
    This is great - however it crashes when I try to add XML to the TXT handler.

  • Anonymous
    March 12, 2007
    Helio, what crashes?

  • Anonymous
    March 12, 2007
    Sorry I misstated really - I get an unhandled exception the gist of it is this: System.UnauthorizedAccessException: Access to the registry key 'HKEY_CLASSES_ROOTXML' is denied. But the app doesn't crash. However, nor does it create the handler association. I tried running as admin...

  • Anonymous
    March 13, 2007
    You're selecting the wrong item in the list.  You want ".xml", not "xml".

  • Anonymous
    March 17, 2007
    The comment has been removed

  • Anonymous
    March 29, 2007
    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

  • Anonymous
    March 30, 2007
    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.

  • Anonymous
    May 01, 2007
    The comment has been removed

  • Anonymous
    May 01, 2007
    It should be possible, but I've never tried.  Good luck.

  • Anonymous
    June 19, 2007
    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!

  • Anonymous
    July 26, 2007
    As part of my work on the Coding4Fun Developer Kit 2008, I created a WinForm control encapsulating the...

  • Anonymous
    July 31, 2007
    The comment has been removed

  • Anonymous
    October 01, 2007
    Thanks. .Divx now previews in Vista. Regards Dane

  • Anonymous
    October 30, 2007
    For PreviewHandlers on XP, look at http://www.azarfamily.org/previewhandlersforwindowsxp GIl Azar did an amazing job there !

  • Anonymous
    November 29, 2007
    Resolved some issues I was having really easily. Thanks :)

  • Anonymous
    December 23, 2007
    Does this code work on Vista x64?

  • Anonymous
    December 29, 2007
    I've never tested it on x64, but I know that others have.  See http://blogs.msdn.com/toub/archive/2007/02/16/update-to-previewhandlerassociationeditor-for-vista-x64.aspx.

  • Anonymous
    December 30, 2007
    One of the cooler Vista features that I've started using more often is the File Preview in Windows Explorer.

  • Anonymous
    December 30, 2007
    One of the cooler Vista features that I've started using more often is the File Preview in Windows Explorer.

  • Anonymous
    January 17, 2008
    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.

  • Anonymous
    March 10, 2008
    Source: http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx...

  • Anonymous
    March 22, 2008
    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

  • Anonymous
    March 26, 2008
    How about the .rar type files ? I can't find it after installed winrar. No prog handler found

  • Anonymous
    April 03, 2008
    The comment has been removed

  • Anonymous
    June 04, 2008
    the tool detects only registered preview handler that already exists. Can it add new ones? eg for dwg. thanks

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

  • Anonymous
    December 09, 2008
    Preview Handlers for Vista and Outlook 2007

  • Anonymous
    December 11, 2008
    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]

  • Anonymous
    January 02, 2009
    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_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPreviewHandlers). Any thoughts or guidance on this would be much appreciated!

  • Anonymous
    January 15, 2009
    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

  • Anonymous
    April 10, 2009
    I can't download this tool! (404) Please fix it thanx

  • Anonymous
    April 10, 2009
    It's available at http://blogs.msdn.com/toub/attachment/1286588.ashx.

  • Anonymous
    October 06, 2009
    Based on your article "View Data Your Way With Our Managed Preview Handler", here a preview handler for .rar file. It can be download at this url http://www.csharpfr.com/codes/PREVIEW-HANDLER-OFFICE-OUTLOOK-2007-10-SUR-FICHIERS_50647.aspx

  • Anonymous
    November 05, 2009
    Has anyone figured out how to preview non-".txt" text formats (such as ".bat") with the text handler on XP? The TXT handler does not show up in the list on XP.

  • Anonymous
    November 09, 2009
    Thank you Steve, it works perfectly for me!

  • Anonymous
    January 08, 2010
    Where can I setup the media player to automatically to a 200% zoom open the video

  • Anonymous
    January 29, 2010
    Has a way to preview dwg files been discovered yet? Thanks Bob

  • Anonymous
    April 25, 2010
    Preview Handler blocking Excel If I preview an Excel file, an instance of Excel.exe is opened that stays open. When I want to preview another excel document everything just hangs. Csan you help?

  • Anonymous
    May 13, 2010
    thanks works really well :) I wanted to get previews of flv vids and amr audio and it worked :) thank u

  • Anonymous
    June 08, 2010
    hey! I've installed that and associated many extensions to Office Word, however when I try to preview them inside Outlook 2007 (running on Win XP), I still get the "no previewer installed for it" message. Any idea on the cause? thx for your time!

  • Anonymous
    September 05, 2010
    The comment has been removed

  • Anonymous
    October 24, 2010
    Sadly all the links lead me to a page Error or to what looks like malware www.winhelponline.com/.../.html (caution!) I don't know why WIndows does not have an easy way to add extentions to the preview handler.  If it has a file association then windows should pick up on what app is used for opening and use that info for the preview handler.  

  • Anonymous
    May 17, 2011
    Hi Stephen,   I need to host the preview handler on a C# Form.  For example, suppose I have a full path of a text file (.txt), I would like to preview the file within a GroupBox control on a .NET WinForm.  How can I do that? Thank you for this great article.

  • Anonymous
    June 12, 2011
    Just wanted to say thank you for this.  I've been trying to get flac files to play in explorer for ages and this was the key! :) Thanks again

  • Anonymous
    June 14, 2011
    Is there a way to preview files in simple windows form. It looks like Preview Handlers form the article are embedded and cannot be used in code, only in Windows? Thanks

  • Anonymous
    November 28, 2011
    anyone know if this can be used to preview ebook files like .mobi or .epub?

  • Anonymous
    January 24, 2012
    Link went dead!!! >,<  anyone know where this can be found now for DL?

  • Anonymous
    April 17, 2012
    Cool tool, why outlook no have built in?

  • Anonymous
    June 25, 2012
    Great tool! :)

  • Anonymous
    September 04, 2012
    I have been trying to figure out how to preview .skp files (Google Sketchup).  Is there a preview handler builder available with a good gui?  

  • Anonymous
    March 09, 2013
    thanks! this worked to fix Outlook 2013 issue. been looking for days on how to get the issue resolved. awesome little tool!

  • Anonymous
    March 19, 2014
    Still using under Windows 7 Pro in 2014.  Works great!  

  • Anonymous
    April 06, 2014
    This helped fix an issue I was having, great tool

  • Anonymous
    August 23, 2014
    The comment has been removed

  • Anonymous
    February 11, 2015
    It works for Windows 7 as well in fixing the PDF preview handler mess (all solutions are given for 64 bit. I seem to have 32) Interestingly it only shows Adobe PDF for Vista even after a reinstall. At least it's a pointer in the right direction. Thanks.

  • Anonymous
    April 18, 2015
    The comment has been removed

  • Anonymous
    October 07, 2015
    Unfortunately not all possible extensions are shown in the combobox Classes/extensions. for example the extension ".sample" ( used in git/hook It can also happen with extensions that are registered during installation of specific software. Could you adapt the GUI so that we can also associate directly to a "new" or self written extension , or that we can add extensions to the list of Classes/extensions. Thanks

  • Anonymous
    November 21, 2015
    I have the same question as Newbie did, but do not see any replies for JPEG previewers. I converted from Outlook Express to Outlook 2007, and am amazed that my old OE has better previewers than the newer, bigger Outlook. Any help so I can see my Jpeg attachments again? Thanks, Ron newbie 2 Jan 2009 7:54 PM # 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_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPreviewHandlers). Any thoughts or guidance on this would be much appreciated!