SAMPLE: HLINKAXD Demonstrates a Hyperlinking Active Document

This article has been archived. It is offered "as is" and will no longer be updated.
HlinkAxDoc (HLINKAXD) is a sample demonstration of the hyperlinkinginterfaces. HlinkAxDoc is an MFC Active Document server that containshyperlinks. In addition to being a container, it is also a hyperlinkingtarget and can be the recipient of hyperlinks from other hyperlinkingcontainers.

HlinkAxDoc implements IHlinkTarget and IHlinkSite. It uses the IHlink,IHlinkBrowseContext, and IHlinkFrame interfaces when jumping to hyperlinksas well as being activated as the target of a hyperlink. Last, HlinkAxDocalso supports the IPersistMoniker interface and demonstrates a basicimplementation of the Load method.
More information
The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

What Is It?

HlinkAxDoc is a basic hyperlinking Active Document server. All it does isstore a list of hyperlink objects that can be used to jump to otherhyperlink targets such as Web pages via URLs or Office documents.HlinkAxDoc can persist this list of hyperlinks, meaning it can save its ownfile format and load it back again, re-creating hyperlinks from theoriginal data. Also, HlinkAxDoc can read Internet Shortcuts as well asHyperlink objects from the Clipboard and from drag&drop operation. Thisallows you to drag a hyperlink from an HTML page in Internet Explorer intoHlinkAxDoc and store the hyperlink for later use. A whole collection ofhyperlinks, with their URLs visible, could be stored and saved in thismanner.

To build this sample, you will need Visual C++ 5.0 with the Internet ClientSDK (InetSDK) installed. The sample will probably need to use the Hlink.liband Uuid.lib from the InetSDK, so you should set your Internet SDK includeand lib directories to the top of the VC search path using Tools->Options->Directories.

Major Players - Objects and Interfaces

There are basically six major characters in the drama of the hyperlinkingarchitecture. First and foremost is the hyperlink object itself. Ahyperlink is a COM object implemented by "the system" (Hlink.dll,technically) that encapsulates all the data necessary to locate anacceptable hyperlink target application and point it to a specific documentor file. Hyperlinks are usually stored in a hyperlink container, which canoptionally implement one or more hyperlink site objects to manage a set ofcontained hyperlinks. Hyperlink containers typically display hyperlinks inthe UI in some visible way and provide a method for creating newhyperlinks. Fourth, applications that can be the recipient of hyperlinknavigation are known as hyperlink targets.

Confusingly, most hyperlink targets can also be hyperlink containers. TakeWord for example. If you create a hyperlink inside one word document thatlinks to another word document and then activate it, the second worddocument is the target of the hyperlink stored in the first document, thecontainer. Upon reaching the second word document, this hyperlink targetcould easily have yet another hyperlink inside it which would go to anotherword document, a URL, or whatever. That is, a Word document can be both ahyperlink container and target.

Hyperlink targets are typically Active Document servers as well asstandalone applications. That is, these servers can open documents insideanother application that supports the necessary architecture to be anActive Document container. (Do not confuse an Active Document containerwith a Hyperlink container.) Of course, the ultimate Active Documentcontainer of all Active Document containers, the uber-container, isInternet Explorer (IE). Internet Explorer also serves as the fifth objectin our discussion, the hyperlink frame. As a hyperlink frame, InternetExplorer has the capability of hosting one or more hyperlink targets thatwork as Active Document containers. Internet Explorer owns the frame andInternet toolbar and provides for the most Web-like hyperlinkingatmosphere. When hyperlinks are made between standalone applications, sometrickery occurs to make the navigation appear smoother. However, thenavigation still happens between two separate frame windows. Whenhyperlinks are made inside a hyperlink frame, there is one frame windowthrough the entire hyperlinking experience, provided all hyperlink targetsare active documents.

Note that very rarely will an application other than Internet Explorer actas a hyperlink frame. So in a sense, this can also be thought of as a"system" implemented object.

The sixth and last major character is the hyperlink browse context. Thehyperlink browse context is another object implemented for you by "thesystem" that encapsulates the functionality of a navigation stack. Thebrowse context stores references to all the hyperlinks that have been madein a particular hyperlinking session. It also stores information aboutregistered hyperlink targets and holds references to targets during aparticular session to keep them open and speed back/forward navigation.Using the hyperlink browse context that gets passed from hyperlink targetto hyperlink target, targets and hyperlink frames can make intelligentdecisions about whether to activate forward or back buttons.

Given that browse context, frame, and hyperlink itself are implemented bythe system, that means developers interested in hyperlinking will typicallyhave to implement only the target and container functionality for theirapplications. This corresponds to supporting the IHlinkTarget interface forhyperlink targets. Containers do not have a specific requirement, all theyhave to do is work with the system-provided IHlink, IHlinkBrowseContext,and IHlinkFrame interfaces. However, they can optionally support IHlinkSiteto help with hyperlink management.

HlinkAxDoc implements IHlinkSite and IHlinkTarget and works with all theother interfaces. It is both a hyperlinking container as well as ahyperlinking target. HlinkAxDoc also works as an Active Document and can behosted in hyperlink frames.

The Internet Client SDK and Platform SDKs have good documentation on thevarious objects and interfaces used in typical hyperlinking scenarios.Please refer to these for more information.

Article ID: 178853 - Last Review: 06/22/2014 18:42:00 - Revision: 5.0

  • kbnosurvey kbarchive kbdownload kbfile kbinfo kbsample KB178853