Adding Help for Your Custom Solution
You can provide online Help that displays general guidelines for using the masters in a stencil or the subtleties of a shape's behavior. Microsoft® Visio® supports both HTML Help (.chm files) and WinHelp (.hlp files). This section assumes that you are familiar with the techniques and terminology used in creating Microsoft® Windows® online Help files. For details, see the Microsoft Platform SDK in the MSDN® Library.
In this section…
Associating Help with a Master
Testing Shape Help
Adding HTML Help that is Integrated with the Microsoft Visio Help System
Associating Help with a Master
You can associate Help with any shape in a drawing, but typically you'll associate Help with masters in a stencil. A user displays Help for a shape from the shortcut menu of the shape or master.
Microsoft Visio locates a shape Help topic using the context identifier (ID) number that is specified in the .hpj file that is used to compile .hlp files, or the .hhp file that is used to compile .chm files. To associate a particular Help topic with a shape, you must provide the context ID number for that topic.
To associate Help with a master on a stencil
- Open the stencil as Original or click the icon on the stencil title bar, and then click Edit on the shortcut menu so you can edit its masters.
- Double-click a master to open its drawing window, and then select the shape.
- On the Format menu, click Special.
- In the Help box, use the following syntax to enter the Help file name and keyword:
- The name of your Help file is
- filename.hlp
- or
- filename.chm
- and
- n
- is the context ID number defined for the topic you want to associate with this shape. For example, Shape.hlp!#63 or Shape.chm!#63.
- Click OK.
When a user clicks the Help command, the indicated topic appears as follows, depending on the Help system you're creating:
- In a standard window that is part of the master Help system for HTML Help.
- In a pop-up window that is not linked to a parent Help system for WinHelp.
If you do not define a Help topic for a shape, the Help command is dimmed on the menu.
Note Pressing F1 displays the Microsoft Visio Help, not a particular shape's topic.
For Visio to find your Help file, you must place it in the correct folder. By default, Visio first looks for a shape Help file in the default folder for Help files (usually the Help folder under the correct language folder in the Visio product folder). You can change the default folder by changing the Help path setting on the File Paths tab (on the Tools menu, click Options).
Testing Shape Help
Make sure your shape Help is as thoughtfully designed as the shape itself. Test the Help and its jumps for consistency and accuracy.
To test shape Help
- Right-click a master on the stencil, or create an instance of the shape and right-click the instance on the page. Click Help on the shortcut menu and check that the correct Help topic appears.
- Create another instance of the shape, point to the instance, and click the right mouse button. Click Help on the shortcut menu and check that the correct Help topic appears.
- Test all jumps to make sure they display the correct topics.
- Check each topic for spelling, grammar, consistency, and accuracy of its content.
Adding HTML Help that is Integrated with the Microsoft Visio Help System
To create a custom Help system that is integrated with the Microsoft Visio Help system, use the InvokeHelp method. The arguments passed to the InvokeHelp method correspond to those described in the HTML Help API. For a list of command values, see the HTML Help API Reference on the Microsoft Developer Network (MSDN) Web site. Microsoft® Visual Basic® programmers can use the numeric equivalent of the C++ constants defined in the HTML Help API header files.
For example, use the following code to show the default Visio Help window:
Application.InvokeHelp "Visio.chm", 15, 0
Use this code to hide the Visio Help window:
Application.InvokeHelp "", 18, 0
For more information on InvokeHelp, see the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference). For more information about the HTML Help API, search for "HTML Help API Overview" on the MSDN Web site.