How File Viewers Work

In the preceding explanation, I mentioned file classes. Technically speaking, file viewers are component objects implemented inside an in-process server DLL. In simpler, more human-understandable terms, file viewers live in a DLL that exports certain functions so that the system can make calls to the DLL to display file contents. The DLL is referred to as an INPROC server, which simply means that it runs only as an add-on to an existing application (in this case, as an add-on to the system-supplied application called QUIKVIEW), not as a stand-alone application.

When a user clicks the Quick View option for an OLE compound file, the system can use the file's class identifier (an OLE CLSID value) to figure out which viewer to use. If the file isn't a compound file, the system uses the file extension to determine which viewer to use.

Because a file viewer is a component object, you can add interfaces and augment functionality to support new features. For example, a file viewer can act as an OLE container application and can activate embedded objects in-place inside the file being viewed. Or you could beef up another file viewer to let the user make a selection in a document and copy the selection to the Clipboard or drag it to another location.