How does dynamic help work?

Did you ever wonder how dynamic help works? The Visual Studio IDE continuously emits keywords and attributes depending on what you are doing in the IDE. Lets start by turning on debugging in Visual Studio. I don't mean the kind of debugging you do to your code. It's easier if I just show you. Follow these steps. Don't worry it's harmless.

  1. Close Visual Studio .NET if it is not already closed.
  2. Open the Windows Registry Editor (RegEdit).
  3. Go to the following key:
    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.0\Dynamic Help
  4. Add a new string value of "Display Debug Output in Retail" with a value of "YES."
  5. Start Visual Studio .NET.
  6. Open the Dynamic Help

Now open a solution and start working, watch the dynamic help window you will see the keywords displayed in the Dynamic help window as you manipulate your code in Visual Studio.

For example if I were to click on a windows form in VB.NET I would see the following in my Dynamic help window.

--- Keywords - priority: 500 ---
(F1 Kwd) Keyword=Designer_System.Windows.Forms.Design.FormDocumentDesigner
(Kwd) Keyword=System.Windows.Forms.Form
--- Keywords - priority: 100 ---
(Kwd) KEYWORD=VS.Ambient
--- Attributes ---

What you are seeing are the keywords and attributes emitted by Visual Studio. This is how Dynamic help works. You can add your own custom help that displays different help links based on keywords emitted from the IDE.

Ok, so now that I know how to get the keywords, how do I add my own custom help? This is a Blog not an article so I'll give you the abridged version, you can look up the rest yourself.

Create a file called CustomHelp.xml and place it in C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\HTML\XMLLinks\1033

Here is what a sample CustomHelp.xml file could look like. Some nodes to take note of:

  • LinkGroup defines a heading in the help to group the links
  • Keywords/Kitem define which keywords trigger this help to display
  • Links/Litem the URL for the help file, the link group it belongs under, and the text to display

The above CustomHelp.xml file will generate dynamic help that looks like this. Well the last group called ObjectSharp Coding Standards

The keyword I used in the sample above (Ambient) is a special keyword. It is always present. Therefore if you want a help file to always be accessible use the keyword ambient in your CustomHelp.xml.

As I'm sure you can tell I have only scratched the surface on this subject. There is plenty more information in the MSDN library.