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 :)
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.
HTML/HTM/XML - 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/MPEG/MP3/MIDI/AIFF/AU - 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 - I didn't implement them myself, but only forwarded interface calls to Stephen Toub's managed preview handlers. You can find them here, along with other useful information about preview handlers (hey, it helped me write my code...).
NOTE: For the ZIP preview handler to work, you need to install Visual J# Redistributable package 2.0 (available from Microsoft's website) prior to installing this package.
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
A self-extracting installer, which silently installs Stephen's (MSDN Magazine Managed) Preview Handler Framework and my small addition, can be downloaded here (MD5: 7580a77ba85a6ba9604e0c6564d0945a).
The source code and compiled executable can be downloaded here (MD5: 158160d4b6498f8e7139d6ccaf7e4518).
NOTE: For the ZIP preview handler to work, you need to install Visual J# Redistributable package 2.0 (available from Microsoft's website) prior to installing this package.
NOTE2: 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.
My source code and package are free for personal and educational use. I only request that if you use part of this package in your own work, please give me some credit for it. Other uses are forbidden unless specifically given direct written permission from myself.
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.
Manual Installation
1. Install the two preview handler packs described in the previous section.
2. 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).
3. 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 written 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. 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 or whatever. My name is Gil Azar, if you're too lazy to go to the top of the page to find my name there :)
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.
