Code Examples‎ > ‎

HV2 API Explore

This code example explores all aspects of the HV2.
Requires: 
Visual Studio 11 (for .NET Framework 4.5 and Help Viewer 2.0)
Code Language: 
C# 

Introduction

These HV2 code examples exercise all the main HV2 API calls and adds several helpful debugging tools.

We won't be talking about the chrome, just the main help API calls at the heart of the code.

Setup

Open the solution HV2ApiExplore.sln (alternatively open HV2Everything.sln and make the "HV2ApiExplore" project the start up project)


The main executable project "HV2ApiExplore" uses 2 other DLL assemblies "Helpware.Misc" (my non-help related support code) & "HV2Lib" (HV2 support code, rendering etc).

Both HV2ApiExplore and  HV2Lib require references to the following 2x Help Viewer 2.0 DLLs. 
Actually only HV2Lib uses the second DLL for the sole purpose of rendering HTML topics.
(in VS 11 we right-click each project's "References" folder and select "Add Reference" and added these DLLs)

C:\Program Files\Microsoft Help Viewer\v2.0\Microsoft.VisualStudio.Help.Runtime.dll
C:\Program Files\Microsoft Help Viewer\v2.0\Microsoft.VisualStudio.Help.dll

  • Microsoft.VisualStudio.Help.Runtime.dll -- This is the HV2 core API which allows you to open catalogs and read catalog data.
  • Microsoft.VisualStudio.Help.dll -- This API allows you to correctly render VS help topics. For non-VS topics you can ignore this and just use the renderer code provided in HV2Lib DLL.

Windows 8 Runtime

To use the Windows 8 Help run-time instead of VS 11 Help run-time:
  1. Remove the 2x HV2 DLL references (listed above)  from both HV2 projects.
  2. Add the equivalent Windows 8 Help DLL (stored in the GAC). This should be registered as a local COM server.
  3. Adjust the HV2 Namespaces (see below).

    Windows.Help.Runtime.dll
Note that Windows 8 does not provide an equivalent to Microsoft.VisualStudio.Help.dll for rendering support. In this case you will need to comment out the VS Help render call in code (which will be obvious because it will cause a compile time error).


HV2 Namespaces

To open and read catalogs you will need this namespace:

using Microsoft.VisualStudio.Help.Runtime;

or if you are coding using Windows 8 help runtime DLL

using Windows.Help.Runtime;


For the one place where we reference VS 11 renderering method you need:

using Microsoft.VisualStudio.Help;

If you are coding using the Windows 8 help runtime, there is no equivalent rendering DLL. 
However, we provide local code to renderer topics. More on this later.



Page: Help Runtime API

The first page tab contains a list of sub-pages that demonstrate all the main API calls.


See also documentation: HV2 API Calls

Page: Content Store

Use this page tab to explore any VS 11 (User Managed) catalog locale store. The contents of the XML files in the store are displayed in the tree view, and if you drill down to a package (.mshc file) you can list the contents of files inside the package (Helpware examples only). Unmanaged catalogs do not have XML files.

Note: The Microsoft example code does not contain the right-hand panels, and associated UNZIP support. The Helpware version of these examples contain additional functionality, including the ability to explore the contents of a .mshc (ZIP) file.

Monitor Catalog Locks: Check this item to monitor the selected catalogs write locks on a timer (via an API call). You will see the locks set ON when you update the contents of a catalog using the Visual Studio 11 help viewer. 



Page: HelpIndex.exe

On this page we provide a GUI for the command line tool helpIndexer.exe.

For more info on HelpIndexer.exe see Catalogs (explains this utility, different types of catalogs, .mshx and .mshi files etc).



Page: Event Log

All errors reported by the HV2 runtime go to the Windows Application Event Log. This includes Help Content Manager errors.

This page is handy as it can list just help events. Both HV2 (VS 11 help) events, and HV1 (VS 10 help) events.





Comments