Generic Viewer/Printing Application for Windows Files | CodeGuru

Generic Viewer/Printing Application for Windows Files

Environment: Visual C++ 5 (SP1), Windows 95 (SP2), Windows 98 (SP1) This is a simple SDI application that allows to view and print the “usual” Windows files from MFC, such as HTML, TXT, DOC, XLS, PDF, PPT and so forth, provided that you already have defined an association for each file type on your system. […]

Written By
CodeGuru Staff
CodeGuru Staff
May 16, 2000
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: Visual C++ 5 (SP1), Windows 95 (SP2), Windows 98 (SP1)

This is a simple SDI application that allows to view and print the “usual” Windows
files from MFC, such as HTML, TXT, DOC, XLS, PDF, PPT and so forth, provided that
you already have defined an association for each file type on your system. It is
based on previous CodeGuru articles
(‘Using HtmlView apart from Tecno Preview
by Iuri Apollonio and
‘Printing Web Pages like Internet Explorer’
by Sriram Srinivasan.

All I have done is to add printing capabilities (and a shortcut, regarding
text files -see below) to Apollonio’s CHView class, and derived my CView from
said class, and it works!

The source sample is a bare bones SDI application, on which I have added the
modified CHView class, GFXEXDISP.H header and the UUID.LIB library.

Note that text files cause a slight complication, since they are not
readily accessible from the browser, and the browser object does not support
the usual text editors. Hence, and since I badly needed a generic viewer/printing
app in a hurry, just wrote a couple of routines for performing a “brute force”
translation of text to HTML on a temporary file. I know that there are many
solutions far better than mine, but… at least it works.

Downloads

Download source – 112 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.