The Microsoft Windows SDK is a set of tools, code samples, documentation, compilers, headers, and libraries that developers can use to create applications that run on Microsoft Windows operating systems. The Windows SDK combines two formerly separate SDKs

How it works: Windows SDK Documentation Part 2

How it works: Windows SDK Documentation Part 2

Many Windows SDK users have questions about the system behind the documentation provided with the SDK. Part 1 of this series explained the basic structure behind the Windows SDK help system. It also looked at how ms-help:// URLs can be used to learn about the organization of the documentation “behind the scenes”. Knowledge of the information in that post is assumed for this post.

In this post, the mechanism behind the table of contents (TOC) will be explained. I will include a couple of easy ways to customize the TOC.

TOC ManipulationTopics that appear in the documentation all belong to an HXS file. Every HXS file is a compressed collection of topic files gathered together. Each HXS represents one unit of documentation, a collection of topics about the same subject. By default (for English), the Windows Server 2008 SDK installs them to %programfiles%\Microsoft SDKs\Windows\v6.1\Help\1033. Each HXS file contains the .htm files of the pages themselves, as well as a TOC definition file (.hxt) that explains how those topics are organized. Outside of the HXS files, in addition, every namespace has its own TOC definition file, explaining where and how each HXS will appear in the TOC.

Here is a table of the three namespaces created for the SDK and its corresponding TOC file:

Namespace

TOC Definition File

MS.LHSMSSDK.1033

MSSDK.HXT

MS.LHSNETFX30SDK.1033

NETFX30SDK.HXT

MS.LHSWINSDK.1033

WINSDK.HXT

Because the .HXT files are simple XML, users have the option to make changes to them and consequently change the appearance of the TOC.

Note: It is highly recommended that you save the original copies of your .HXT files somewhere safe as a backup so that you are able to retrieve them later if you want to restore your TOC to its original state.

Note: Whenever a change is made to the TOC, DExplorer will need to be closed and reopened before those changes will take effect.

Different TOC Node TypesThere are several different kinds of tags in the HXT files, each corresponding to a different behavior in how the TOC is displayed to the user in DExplorer.

A “Regular” node is simply a container. It will provide a nest for child nodes. If the tag contains a valid Url= attribute as well, clicking that node in the TOC will also navigate to that topic. In other words:

This will create a TOC node called “Getting Started”, and everything until the closing tag [Other TOC info…] will be nested inside of it. Clicking on that node will also navigate to the indicated page.

Regular nodes don’t have to wrap anything, they can serve almost like bookmarks to topics, with no nested contents underneath of it.

The other most common type of TOC node is the “TOC” type. It passes control of the TOC over to the individual HXS files, plugging them in. It looks something like this:

<HelpTOCNode NodeType="TOC" Url="functioncatnat"/>

In this kind of node, the Url must refer to the name of an HXS file that appears in the same namespace. It is possible to turn control over to an HXS file in a different namespace by adding the namespace in question before the name of the file.

So what does this all mean to the user? It is possible to customize the TOC with most commonly used materials gathered in one place.

For instance, a developer that uses the System.Web.Services namespace a great deal and wants to pin it to the top of their TOC, and also wants to keep handy the character class codes for regular expressions, and also wants to keep the cascading style sheet topics toward the top might modify the top of their MSSDK.HXT like this:

This creates a new top level node called “My Favorites” at the very top of the TOC. Underneath of it is a node called “System.Web.Services Namespace” that contains all of the API reference topics for that namespace. Next is a singleton node called “Regex Character Classes” that points to the specific page that has the character class codes on it. Last is a node called “Cascading Style Sheets” that points to the CSS topics.

In some ways this can be more powerful than simply bookmarking things in your Help Favorites. This is because you can reorganize multiple sets of topics by referring to their HXS file, rather than bookmarking one single topic at a time.

ConclusionWith this basic information it’s easy to manipulate the SDK TOC in ways that make sense to the user. Just be sure to save the originals so you will have a backup. In a later post we’ll discuss how to merge together multiple sets of documentation from different products. For instance, many users are interested in combining their Windows SDK documentation and their Visual Studio documentation in a customized way.