Introduction
Hi all!
As soon as I've installed Microsoft Office 2007, I've noticed this new Preview Handlers feature integrated into Outlook's Reading Pane. So I thought to myself, "hey, that's pretty cool! Let's download some previewers from the net!". But oh what a disappointment, no Preview Handler that worked under Windows XP sp2 could be found! How can that be?
My spirits were down, but I did not lose hope. I started reading here and there, found this really cool implementation of preview handlers (written in C#) for Windows Vista by Stephen Toub (thanks Stephen! ^_^), but as cool as that implementation might be, it only worked under Vista, which was very frustrating for me...
So I decided to download the Windows SDK and try my luck with this new (incredibly unsupported) feature. After a few nights I have developed the code you can download here, for free :)
UPDATE 29/10/2011:
- Added more XML file types to web preview handler
- Added more media file types to WMP preview handler
- Upgraded project to VS2010, removed VC++ Redist dependency
- Shamefully failed to add a QuickTime preview handler. If you find out why, let me know!
UPDATE 27/08/2010:
- Added Tim Heuer's Code Preview Handlers to the automatic installer
UPDATE 20/07/2010:
- Added .config, .psq, .xps, and "xmlfile" file types to web preview handler
UPDATE 10/12/2009:
- Added prerequisites to installation
UPDATE 17/04/2009:
- Fixed CSV preview handler
- Added preview handler for .resources files (using the MSDN wrapper)
UPDATE 13/01/2009:
- Added preview handler for CSV files (using the MSDN wrapper)
- Added preview handler for SNP files (MS Access snapshots)
- Added preview handler for MPE files (using the WMP ActiveX control)
- Fixed a bug in html preview handler
- The code is now compiled using VS2008 (was VS2005)
A bit more info
For some file types I wrote the implementation myself (pdf, windows media, web/xml), and for others (zip, msi, cs, js, vb, sql, and more) I created a quite nifty Preview Handler Wrapper, which basically delegates all the interface calls to the already-implemented preview handlers, managed or not (i.e. which only worked on Vista or not).
The biggest technical problem one has to tackle here is creating a COM server for the preview handler objects which works OUT OF PROCESS (i.e. in its own EXE file) instead of IN PROCESS (the ones that were only available (at my frustration point) and implemented in .NET, i.e. "managed code", i.e. "not for WinXP").
The reason Microsoft had the preview handlers work out of process is probably mainly due to security reasons. The problem with Windows XP (sp2) is that it doesn't have this default preview handler surrogate called prevhost.exe (which only comes with Windows Vista), that basically takes in-process implementations (managed/.NET code among them) and runs them out-of-process (which is what I've done here, actually, only much more generic, and, well, better :-P ).
Screenshot
Here's a sample screenshot of an Outlook message window with a Windows Media file preview:
(yes, the date is written in Hebrew. I'm Israeli.)
Supported Types
PDF - This handler uses Adobe Reader's ActiveX control. If you want to use Foxit Reader instead, please use Tim Heuer's handler (thanks Tim!).
SWF - This handler uses Adobe Shockwave Flash's ActiveX control.
SNP - This handler uses Snapshot Viewer for Microsoft Access.
HTML/HTM/XML/XSD/XSLT/WSDL/MHT/CONFIG/PSQ/XPS - This handler works about the same but with Internet Explorer's ActiveX control. I probably should have added a few more file types to this handler.
ASF/WMV/WMA/AVI/WAV/MPG/MPE/MPEG/MP3/MIDI/AIFF/AU and more - The same, but with Windows Media Player's ActiveX. I didn't test all of these, but they should work fine.
ZIP/GADGET/MSI/RESX/SNK/KEYS/CSV/RESOURCES - I didn't implement them
myself, but only forwarded interface calls to
Stephen Toub's managed preview handlers.
CS/VB/SQL/JS - like the previous group, I didn't implement them, but added them to my nifty wrapper. For these file types I used the implementation that can be found here in Tim Heuer's blog (thanks a bunch Tim!).
Download
The installation package can be downloaded
here. It installs two prerequisite packages from Microsoft (see Manual
Installation below for details), Stephen Toub's MSDN Magazine Managed Preview
Handler Framework, Tim Heuer's Code Preview Handlers, and then my addition.
The source code and compiled executable can be downloaded
here.
NOTE 1: If you want to override PDF handling to Foxit Reader instead of Adobe Reader, you can install Tim Heuer's handler (thanks Tim!) after installing this pack.
NOTE 2: At this point I'd like to
suggest another useful tool by Stephen Toub that lets you edit the list of associated
preview handlers installed on your system. You can find the utility
here.
NOTE 3: My source code and installer above are free for any use. I only request that if you use them in your own code or product, please give me some credit for it.
Manual Installation
1. Install Microsoft Visual J#® 2.0 Redistributable Package available here.
2. Install Tim Heuer's preview handler pack.
3. Install Stephen Toub's MSDN Magazine Managed Preview Handler Framework. I've noticed they removed the download from the original site, so I hope it's ok to let you guys download it from here (MD5: aceb8dfdcde744a11263fb42ad9e5ae5).
4. Put PreviewServer.exe (found in the source code package available in the above section) in any folder on your hard drive (where you won't delete or move it afterwards).
5. Run "PreviewServer.exe /regserver" (without the quotes) to register the preview handlers in the registry. Note that you must register this server only AFTER you've installed the previous handlers, since it overwrites some of their registry values. If you decide to move the file to a different location or reinstall the previous preview handlers, you'll have to register this server again.
Uninstall
Currently there's no automatic uninstaller. To uninstall, you'll have to follow the following steps:
1. Remove MSDN Magazine Managed Preview Handlers from the Add/Remove Programs
dialog.
2. Remove Code File Preview Handler from the Add/Remove Programs dialog.
3. ONLY THEN remove the rest of the handlers by running "PreviewServer.exe /unregserver" (without the quotes). If you used the automatic installer, the default installation path (where PreviewServer.exe is) is "<ProgramFiles>\Preview Handler Pack" (without the quotes).
How to Contact Me
You can reach me at prevhandler@azarfamily.org for any questions, suggestions, help, contributions, etc..
Links / Special Thanks
I would like to thank Stephen Toub again, for all his mentioned tools and code -
they've been the building blocks of my contribution.
I would also like to thank Tim Heuer for creating the
Code Preview Handlers which I've also found quite useful.
