(Note: I completely rewrote this post on 18th March 2010 to bring it all up to date.)
Back with the release of Windows Vista, Microsoft introduced the concept of preview handlers. These let you preview all different file types from within Windows Explorer. Even better, they are both extensible (so you can add more types) and they work in Office too.
To make them more developer friendly, I developed a set of preview handlers for file types commonly used by developers.
The pack works with:
- Windows Vista
- Windows 7
- Outlook 2007
- Outlook 2010
The pack adds support for:
-
ActionScript (.as)
-
ASPX (.aspx)
-
C# (.cs)
-
CSS (.css)
-
Diff (.diff, .patch)
-
DOS (.bat, .cmd)
-
JavaScript (.js)
-
Ruby (.rb, .rhtml, .rjs) thanks to Ivan Porto Carrero
-
SQL (.sql)
-
VB (.vb)
The project is basically just a stitched together set of other people’s work – there wasn’t much left for me to do considering:
- 95% of the interop code came from Stephen Toub’s excelent article ‘View Data Your Way With Our Managed Preview Handler Framework‘
- The code highlighting library used is Lonwas.Highlight written by Thomas Johansen
If you’re interested in contributing your own ideas or adding more file types, just over to the source repository on CodePlex.
Heya Tatham – very nice man!
This will definitely come in handy.
Cheers,
Matty
Hi Tatham.
Do you actually use Vista on your dev machine? I really like the vista styple + the new features but I am hesitating to upgrade because I heard rumours about nasty bugs with VS and especially third party software that runs smoothly on XP.
bye,
Elmar
P.s.: *.config
how do i preview pdf files in outlook 2007 with the operating system as XP.
Awesome. thank you
anychance of a html previewer ?
The site looks great ! Thanks for all your help ( past, present and future !)
Would it be possible to build a Visio previewer? We use it all the time and can’t preview files in Vista. It is really annoying.
@Nelson:
Wow – you mean they still make Visio? :p
If you’ve got any ideas on how I can render a Visio document in Windows Forms, I should be able to add this support for you relatively easily.
XP did make the preview the first image of the cbr(rar)and cbz(zip) format files used for comics. A very practical tool to easily explore your collection. This feature is not supported now in Vista letting only to artists in programming as you to do the job. Such a “visual” system as Vista could be more consistent with early steps yet conquered. Normal users missing that facility will wait for an experienced and kind programmer to complement again the lazy Bill’s programmers. However, in the interim, congratulations on your new preview handlers.
Great tool, thanks
It works great, but it has one small annoying problem. When, for example, I preview a file (a .sql file in this example), and then I edit it in notepad, I cannot save the file because there is still an open handle to it.
Even after I click off of the file, the handle still remains. I have to close the explorer instance to get the handle to let go of the file.
I figure this is just a part of the methods provided…but i thought i’d ask anyway.
What? No PHP preview?
Very nice.
I’d love to see some .as (actionscript) preview support, it’s pretty much ecmascript/javascript.
Hi Dave,
I’ve associated .as with the existing JavaScript previewer.
Thanks for the note. 🙂
I just recently downloaded and installed this utility and I’m having a problem. When I try to preview .sql files it says there is a problem with the T-SQL previewer. Are there any known issues with this previewer? I’ve even tried rebooting the computer but now success.
Thanks!
Erik
Woohoo – we passed the 1000 download mark last fortnight and I didn’t even realise. I seriously didn’t even think people were using this …
very nice web site. My English is not so good, so I do not understandt it well, but it seems very good. Thanks
I am just looking for a previewer for .html files. I know Vista has one, but has anyone written one for Outlook on XP? Many of us would be grateful if you did.
Same problem with the T-SQL preview handler as Erik above. The error in the preview pane reads:
This file cannot be previewed because of an error with the following previewer:
T-SQL Code Preview Handler
To open this file in its own program, double-click it.
FYI, I’m using Outlook 2007 on Windows XP Pro SP2.
Tatham, can you look into this? Thanks.
.xml, .xst, .xsd would be good too.
I agree, .xml, .xst, .xsd would be great too.
Like Steven Vallarian, I have come across the problem that makes a previewer less than useful. If I preview an Excel file, an instance of Excel.exe is opened that stays open. This prevent me from double clicking an Excel file because the excel.exe that is already running prevents me from getting at Personal.xlsb, so my macros are not available.
The only way I can use Excel freely is to shut down Explorer after previewing, then open Excel, then do File, Open and navigate to the file. Hardly practical!
Could you suggest a solution?
How about adding support for VBscript (.VBS) files?
I would love to be able to preview .MHT / .MHTML files
This is the “Excel 2000” output for some horrible reporting software we’ve been forced to use. It has other options, but this is on the only output we’ve found that we can even open. The Excel 2003 option simply doesn’t work, so we’re stuck with MHTML on dozens of daily reports. Drives me crazy!
to Mike
Download “MSDN Magazine preview handlers pack”:
http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/PreviewHandlers2007_01.exe
and associate .MHT / .MHTML estensions with “MSDN Magazine Internet Explorer Preview Handler”. Search for PreviewHandlerEditor(for the associate issue) on google../msdn../yahoo.. .
You can do that for every FileType supported by Internet Explorer(pdf, svg, xml,…..(office),…, TeX)
I found a registry hack to support xml based files by previewing them with the aspx previewer:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.xml\shellex]
[HKEY_CLASSES_ROOT\.xml\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@=”{c3da7028-8de0-11db-96b6-005056c00008}”
Paste this into an empty .reg file. Support for other filetypes can be added by replacing the .xml in the key.
It seems to lock my files so I’m unable to delete them after being previewed… 😦
Great product But I’ve found another free preview handler which offers additional features:
– Supports XML (.xml, .xsl)
– Supports PHP
– Supports Perl
– Supports more than 20 other file formats
– Written in C++. Faster and lower memory usage.
– Files are not blocked when viewed. E.g. they can be saved/edited/deleted.
The preview handler is available at:
http://www.smartftp.local/client/addons/sourcepreview.php
Regards,
Cyber
I apologize for the wrong link in the last email. The correct link is:
http://www.smartftp.com/client/addons/sourcepreview.php
I could use a preview handler for old Word Perfect files in .LTR and .WPD format.
Thanks.
Kelly
Hello, Thanks for this article. based on my personal experience (I have tried it successfully) you can get more previews by integrating Vista Preview Pane with QuickView Plus (as IE plug in). (www.avantstar.com).
unfortunately it’s a little expensive shareware with 30 days trial. But there’s always another “way”, you know what i mean.
The vendor tells about it still doesnt fully support Vista, but the IE plug in will still be installed as well.
It supports more than 400 file types included most of known documents, images, and even apps binaries. So superior in my opinion. You don’t need associated applications anymore, and mainly no need to create specific preview handler any more. same thing due to other IE viewer activex plug ins.
1. Download and install QuickView Plus on Vista. Launch it, Configure your custom file for IE plug in by clicking View – Confifugure QuickView Plus – Applications – Internet Explorer (IE plug in). then add your custom files (e.g. .dwg, .psd, .dll etc with their correct content type (MIME)
2. Download MSDN Preview Handler. Install it.
3. Download Preview Handler Editor or Preview Handler Configure. Open it then Look for “MSDN Internet Explorer Preview Handler”. select and add your custom files
4. Activate Vista /Outlook preview pane. Select your file. the preview appears perfectly now.
That’s it. Hopefully works. To me, it always works so far.
Thanx and regards-Amirz
to Cyber.
Thanks for the info about smartftp source preview handler, is great.
I manage to edit “SourcePreviewHandler.dll” using ResHacker and change the ugly Courier New font to Consolas, now is perfect 😉
it would be better with other languages support, but thanks..
Like Manuel, I also added additional extensions for the XML-type files. My current list is: .asax, .ashx, .config, .csproj, .resx, .user, .vbproj, .xml, .xsd, .xslt
HTML and XML please….Visio also useful
is there a previewer for .wav files?
On my machine, under XP with Office 2007 it will not work to preview in Outlook 2007 for files received as attachments to emails.
Outlook notices that the file extension of the attachment matches and gives you a button to click to preview but when you click the button it says there is an error in the previewer and you will have to double-click to see it.
Any ideas?
Thanks.
I have the same experience on Server 2003 (enterprise) with Outlook 2007 — preview hanlder is registered, but an exception of some kind prevents it from previewing the attached file. In my case, I’m most interested in SQL files, I trade them frequently and would benefit from the previewer. I am using SSMS 2005 and SSMS 2008 on the same machine.
Is this a file permission or Office trust issue?
Hi I am using the windows 7 beta, any chance of getting the previewers working with windows 7?
I loved your previewers on vista 🙂
Thanks
Hi,
same problem as Douglas.
Does anyone know how to preview *.sql files with Outlook 2007 ?
thx
I cant get this thing to install… it just sits there saying “please wait” forever…..??
Has the locking issue been taken care of yet? If not, is there any target date that a fix for the locking issue will be provided.
Any chance of getting a previewer for the Cricut Design Studio software?
Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.
Hi
I have downloaded and installed – how do I enable/activate in Outlook?
my previewers in microsoft 2007 don’t preview pdf files. any1 got a solution
And nice .wrl files ?!
.wrl is VRML, right? Why would you want to preview that?
I have made lots of!
Thanks for this – i’ve been searching for something like this for weeks. Nice job.
Any chance you could post the code for this or put it up on github/googlecode? I’d be interested in contributing some patches/features.
Hi Jared,
The code is up at http://previewhandlers.codeplex.com/ and Thomas has republished the highlight library at http://highlight.codeplex.com/
Thanks,
Tatham
Thanks Tatham! I’ll check it out!
looks like there is a bug where the previewer doesn’t release the file lock correctly because I can no longer save a file after is has been opened in the preview pane. Anyone else seeing this?
very nice!
Only .csv file extension is missing (tried with Outlook 2010)
Maybe you can add it?
Hi there…
I am Using Office 2010 and XP SP3…
I am very keen to use this Preview handlers but dont know how to do it…
I want to use since 6-7 Months when i was using office 2007…
i want to preview HTM files in Preview pane but not able to do so…. only some Preview are available now like PDF preview but not the HTM one yet…
help me to apply the preview handler in my computer…
Thanks.
I can’t get the wav preview to work correctly in Outlook 2007 on Vista. I can see the preview in the preview window and I can play it, but I get no sound through the headset. All other system sounds are coming through the deadset fine. Any ideas?
Sorry its Windows 7 I cant get it to work properly in.
Hey Tom
I want to do this preview handling in my outlook add-in but am kinda new to programming. So it would be great if you can tell me something how to start building one.
I am also using Office 2010 and XP SP3…
I am eager to know how could I preview HTM files in outlook…
Can this be added to and used in a home grown Explorer type program written in Microsoft Visual Studio 2008 C#??
Would be nice to have “.PS1” support, my PowerGUI is so slow.
Hi Ross,
It’s all open source on CodePlex. 😉 Feel free to add .ps1 support and I’ll publish a new build.
— Tatham
Can we please get a x64 build?