Preview C#, Visual Basic, and C++ Source Code Files Direct in Attachments Without Opening

»»»Preview C#, Visual Basic, and C++ Source Code Files Direct in Attachments Without Opening

If you’re the developers or programmers, you can have the ability to able to fast preview the contents or the source code contained inside a source code file, without having to open up the file in resource hungry default viewer Visual Studio to view it, especially if you receive the source code file attachment in email. In Windows Vista or later Windows versions, and Microsoft Office Outlook 2007 or later Outlook versions, the built-in preview feature or previewers is able to render and show the contents for most common file types, and it’s also possible to extend the preview capability to unsupported file types with custom preview handlers add-ins. However, if you just want to be able to preview C#, Visual Basic, and C++ code files (with .cs, .vb, .cpp, and .h extensions), here is a simple trick to enable the preview handlers for these source files without any installation.

By default, Windows and Office comes with Microsoft Windows TXT Preview Handler, which is the preview handler that renders .txt text files. However, this Windows TXT Preview Handler can handle more file types than it’s actually registered to support by default, as nothing in this preview handler that restricts it to working with just a text file with .txt extension, and prevents it to working from text files with other extensions.

As you know, C#, Visual Basic, and C++ source code files in .cs, .vb, .cpp and .h extensions are also a text file, which is fully supported to render by Windows TXT Previewer Handler. However, Windows and Outlook don’t register the association of these file types to be rendered for previewing by Windows TXT Preview Handler by default. To enable the support of preview for file with extension of .cs, .vb, .cpp and .h, simply copy and paste the below text into a text editor, and save it as a file name with .reg extension. Then double click on the .reg registration file to merge or insert the registry value into Windows registry.

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}"

Once registered, you can now view or preview the source code directly from Outlook even if it’s send as the e-mail attachments, without the need to open to source code file in Visual Studio or other text editor.

By |2017-01-26T03:23:28+00:00January 26th, 2017|Categories: Developer Tools|Tags: , , , |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.