I found instructions for doing this here:
http://msdn.microsoft.com/en-gb/magazine/cc163487.aspx
Scroll down to the section "If You've Got It, Flaunt It". From the article:
"There are a handful of preview handlers built into Windows Vista. However,
some of them can actually handle more file types than they're registered to
support by default. Take, for instance, the Microsoft Windows TXT Preview
Handler. As you can guess, this preview handler renders .txt files. But
nothing about this preview handler restricts it to working with just .txt. As
a developer, I frequently receive C#, Visual Basic®, and C++ code files as
e-mail attachments. And I'd love to be able to preview these attachments
within Outlook, rather than having to open Visual Studio® as the default
viewer. Well, I can. All I have to do is register .cs, .vb, .cpp, and .h
files as extensions to be previewed with the Microsoft Windows TXT Preview
Handler. The following .reg file does just that:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.cs\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
[HKEY_CLASSES_ROOT\.vb\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
[HKEY_CLASSES_ROOT\.cpp\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
[HKEY_CLASSES_ROOT\.h\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
"