Introduction | Help Project | Tools | Help Compiler | Compiling | Pictures | Character Sets | Macros | SHED | Text Editors | Word 2000 | Notes | Bitmap & WMF | Drawings | DLLs | Conclusion | Notice | home page

Mascotr_harvey


Windows Help Files

This is not a tutorial about using or making Windows help files. You won't find a lot of everyday help tips here. It's for the professional, and for those times when your project has been cruising along smoothly for a week, then bang, you're broadsided by a bug or help file limitation.

If you are not interested in creating help files, this document should still help to explain why help files frequently disappoint us.

Introduction

I'm often asked for a quick overview of how to make a help file. It surely cannot be that difficult; after all, HTMLcat is simple and easy to use, so it couldn't be that complicated. Well, it is.

And it's more difficult than the previous paragraph led you to believe.

And even more difficult than that.

Ironically, the poorest documented, and therefore least understood, part of programming is creating online help. Wait a minute -- documentation is undocumented? Yes. That's why most programs have truly awful online help.

Project planning begins with a few considerations:

From the user's point of view, which is the only view that really counts, help files are very nice places to work. Most projects are compromised by selecting tools and processes to make them easier to complete, instead of easier to use.

The Help Project

Are you sure you want to use a help file?

The issue is further clouded by HTML, which is a much nicer and more portable way to write and design than Windows help files. HTML requires every computer user to have an Internet browser installed, and know how to use it. Standard HTML offers no document security, and control over page layout requires style sheets.

HTML Help
Microsoft HTML Help makes versatile, flexible, modern documents easier than standard Windows help files, and easier to use than a browser, though the viewer is relatively slow and memory-intensive, which restricts the product to higher-powered computers. Even though the user doesn't see it, Internet Explorer is still required, plus many, many support files. To ensure that readers have the required software, you will have to distribute at least 20MB of Microsoft files with your finished HTML Help project, or restrict it to Windows 98 or later.

Adobe PDF™
Adobe's page-description file format is an excellent alternative for distributing large, heavily-formatted documents like manuals and brochures. PDF viewers are available for several operating systems, making the documents truly portable. Many complain that PDF viewers are slow and perhaps a bit clumsy to use. PDF is a powerful platform, which means that it requires a good computer with lots of memory and storage space.

PDF is commonly used as a distribution format for documents that will be printed. You can embed fonts and high-resolution images, to create master documents that print accurately, without concern about the output device.

Summary
If the goal is producing a polished, professional product with minimal investment in training and experimentation, and you have no background in or interest in producing help files, consider using HTML. If you're writing online help for an application that must run in any version of Windows older than Windows 95, it should be a Help file. Other solutions are difficult to integrate with an application, and any HTML or PDF solution requires the user to install many megabytes of additional files. Besides, the document you're now reading is about making help files.

Help File Tools

Many software developers begin with good intentions, planning to create commercial tools to aid making help files. Somewhere along, every developer comes to realize that there is little market, and a lot that needs to be done. Some, realizing that they will sell literally 20 units (plus a thousand illegal copies) over the life of the product, drop it. Others turn it into a hobby, and release partly-finished tools, free of charge. Help file developers are left with undocumented (or incorrectly documented) processes, and unfinished tools. There are a couple of high-priced help tools around, but nothing offers automated ways to exploit the full potential of help files.

RTF Tools
Help file projects begin as one or more Rich Text Format (RTF) documents, usually edited with Microsoft Word for Windows version 6 or 7 (for 16-bit help files) or version 9 (for 32-bit help files). The word processor must support manual page breaks, keep-lines-together, keep-with-next, double-underlining, footnotes, and hidden text. For the best-looking, most-consistent help files, the word processor should also support style sheets.

The RTF file format describes a text formatting language. Pictures are not usually placed in the document, but referenced by special tags (which turn a visual word processor into a code-based monster). The help compiler program reads commands in the help project file (HPJ file type) that tell it how to combine the words and pictures into the HLP file.

Start with RTF documentation, and hope you never need it:

Now look for tools:

Help Compiler
The help compiler translates RTF documents into HLP files:

Compile the Help Project

This topic is worthy of a book all by itself. Here it is, in a tidy little bulleted list:

If you are using the 32-bit Help Workshop to maintain the help project, most HPJ details are taken care of automatically, and RTF incompatibilities are fixed as-needed.

Browsing Help Files
Often called Help Author Mode, add the following lines to WIN.INI:

[Windows Help]
SeqTopicKeys=1

After you restart your computer, these new keystroke combinations will work in all help files:

KeystrokePurpose
CTRL+SHIFT+RIGHTMove to next topic.
CTRL+SHIFT+LEFTMove to previous topic.
CTRL+SHIFT+HOMEMove to the beginning of the help file.
CTRL+SHIFT+ENDMove to the end of the help file.

Using Pictures

Carefully designing bitmap pictures reduces file sizes significantly. For instance, a pattern of long horizontal lines compresses down to almost nothing at all, while long patterns of vertical lines don't compress at all. This technique, by the way, also works with GIF pictures, used with Internet documents.

Here are some notes about bitmap pictures:

Ostensibly a portable document specification, Windows help files often do not display correctly on Macintosh computers (especially if they contain WMF pictures), and help files that call functions in 16-bit DLLs don't operate correctly under Windows NT, 2000 or XP.

Character Sets

Word Processor Macros

Special symbols are exported by Word for Windows using proprietary mnemonic tokens. The problem is, the 16-bit help compiler doesn't recognize these shortcuts, so it deletes the characters. That's why hyphenated words run-together, and quotation marks are missing.

You can turn-off smart quotes, and stop using em dashes, or you can use a program to fix the proprietary codes.

After exporting the document to RTF, load it back into the word processor as a text file, then search and replace these characters, or write a macro to do the work for you. The macros look for strings that begin with a backslash and the following Word for Windows RTF tokens:

WinWordCodeNotes

"\lquote "

"\'91"Left single single quote ‘ (145)

"\rquote "

"\'92"Right apostrophe ’ (146)

"\ldblquote "

"\'93"Left smart quote “ (147)

"\rdblquote "

"\'94"Right smart quote ” (148)

"\bullet "

"\'95"ANSI character 149 bullet • (149)

"\endash "

"\'96"Not supported by Macintosh – (150)

"\emdash "

"\'97"Not supported by Macintosh — (151)

"\~"

"\'a0"Non-breaking space   (160)

"\emspace "

"  "Not required for Help 4

"\enspace "

" "Not required for Help 4

These characters are translated by Word for Windows in the RTF. The help compiler doesn't know the characters, so it ignores them. Replace the WinWord text with the codes, and the characters will work correctly.

Changing "\~" to "\'a0" fixes the non-breaking space problem.

Only tokens that fall within one line (one paragraph) in the RTF are seen by macros. The codes must fall within the first 260 characters of a paragraph. One work-around is to use short paragraphs (a good idea, anyway). In practice, most codes do not fall at the end of a line--bullets, for instance, are at the beginning of the line.

SHED Notes

This program creates rectangular hotspots within pictures (bitmaps or Windows Metafiles).

Text Editor Notes

If you edit the RTF document directly, some text editor settings affect how the document is saved.

Microsoft Word 2000

I've used Word daily since 1986, eagerly anticipating every upgrade. It may be surprising that I stopped upgrading in the spring of 1995, with a beta version, then the retail release of, Microsoft Word 7.0 (also known as Word 95). Besides the problems reported of Word 97, it had a deserved reputation for exporting RTF that was incompatible with 16-bit help compilers.

In May of 2001, I finally chose Word 2000 (version 9.0.3821 SR-1). Yes, it's a bit late, since Microsoft Office XP is available. The version I bought is the last one to install without mandatory product activation. I'm investigating moving to Sun's StarOffice for compatible RTF files (see the Links page).

The 32-bit help compiler works with Word 2000 RTF files, though it complains about some unexpected font information. I've yet to get any 16-bit help compiler to accept Word's latest RTF files, and the fix would take a big macro.

The latest version of the help compiler can handle Word's capricious RTF changes without problems; if you can't get a copy, try this fix. However, the word processor in Microsoft Works 6.0 does export compatible RTF files -- well nearly, anyway, because at least I could quickly correct the problem. Load the DOC into Microsoft Works, then export to RTF. Be sure not to edit or save the DOC file within Works, because some of your formatting may be lost. Works uses incomplete font descriptions within the \fonttbl section of the RTF header:

{\f0\fcharset0 Arial;}

You can correct the error by adding the missing portion of every font description:

{\f0\froman\fcharset0 Arial;}

Load the RTF document in a text editor, and replace every occurrence of \fcharset0 with \froman\fcharset0, then save the file. Remember, the DOC file is the master document, the RTF is just a discardable intermediate file.

Help Compiler Notes

If you've tried Borland's "Creating Windows Help" help file, you're probably very confused. For example, they think that {bmc} inserts a centered picture. (Borland uses RoboHELP now.) At one time, you could go to http:\\www.helpuniversity.com to look for better documentation, but this link is probably broken. They also had a help decompiler, which I don't want to recommend (but you can use techniques in help files that make decompiled help files tough to recompile cleanly).

Bitmap and WMF Notes

You can use 24-bit bitmaps in 16-bit help files by placing them in WMF. But that's a terrible waste of space. If possible, use WMF (Windows Meta-file) instead of bitmaps. Here are some things to consider when deciding to use WMF:

There are several reasons to use WMF instead of bitmaps. First, you can get more colors. Second, the picture automatically scales for the screen resolution. Third, files are much smaller--I've replaced 12K bitmaps with 800 byte WMFs that look better. There are a few disadvantages: performance is slower than bitmaps, Macintosh help viewers can't handle WMF, and if you are using 16/256-colors, you have to use a very limited palette to minimize ugly dithering. You can experiment to get a smooth palette; I use about 58 colors that look good on any screen.

Drawing Programs

We use RTF as an intermediate file, never the master, since a new one is created by the word processor whenever we change a document. In the same way, WMF files are intermediate files that are exported by drawing programs. Save the master picture in the program's proprietary drawing file format, then export the file (or a small piece of it) to WMF when the design changes.

I've had good luck with Micrografx Designer 7.1. That is, once I got it patched. Go to http://www.mgxsupport.com to get the 7.1 patch. And whatever you do, never select text and then CTRL+drag to copy it to a new place, then immediately double-click on the copy (you'll probably try it once -- just once).

Designer 7.0 correctly exported WMF, but Designer 7.1 defaults to something incompatible. You can patch Designer 7.1 by following the instructions in this message from Micrografx support staff:

"Thank you for your post. Under which version of Windows do you have the software installed? We have reproduced this under Windows NT 4.0. You should change the GDIWMFFILTER to = 1 (Tools/Options/Registry tab/Translation Key) and use the file type "Microsoft WMF" for the Export, and this should help."

Be careful, because there's a second WMF file type listed, and it doesn't work. (And why, after they've confirmed that it doesn't work anyway, do they need to know the Windows version?) There are two kinds of WMF files: standard (much like a stand-alone drawing), and placeable (like an OLE embedded object); the help viewer supports only placeable WMF.

Always save the picture as a Designer DSF document, and only export as you need. Don't try to import WMF back into Designer -- their import filter is quite limited!

If you use the Windows Clipboard to insert Designer drawings into Word for Windows, use Paste Special, and select Picture.

Designer 7.1 no longer adds an extra transparent rectangle around exported objects, which is nice. But it adds an unnecessary "Created by..." record to every WMF; this inflates every WMF file by about 58 bytes. There's a work-around, if you want to use a binary editor:

Manually edit the WMF and delete the message. The unneeded record begins with (these are decimal character values):

29 0 0 0 38 6 15 0 47 0

Followed by the copyright string:

MGXI: created by Micrografx, Inc. Mgxgre v1.00

Next, two null bytes:

0 0

Followed by:

4 0 0 0

Remove everything except the trailing 4 0 0 0. Now save the WMF, and try to import it back into Designer. If it's scaled incorrectly or otherwise scrambled, try again. Note that Designer does not import WMF correctly, so fonts, tab stops, and some other objects will be inaccurate -- but the picture should load without errors.

Note: There may be another 29 0 0 0 section before the one we want--don't touch that one! This patch applies only to Designer 7.1 meta-files!

Here's an unrelated Designer 7.0 fix. If you don't like font style previews in font lists, (slow, and wipes-out the disk cache), add the following registry numeric key (use the Designer Tools.Options.Registry tab to make it easier).

Preferences/PreviewFontCombo    0

After all that, Designer has dropped from the radar, and Micrographx is now a division of Corel. I would be extremely surprised to see Designer ever regain the stature it held in the early '90s.

Corel Draw
Old versions of Corel Draw have problems exporting WMF. Corel Draw 9 appears to export WMF files correctly, including font names, and without extraneous data fields in the file. It's perhaps the best solution to the WMF problem, even though it has horrific memory leaks that expand every time you export another file to WMF. Reboot the computer after exporting a half-dozen files.

Adobe Illustrator
Version 8 of Adobe Illustrator does not export WMF, other versions through 9 make good WMF, but only if you don't use any fonts; unfortunately, we usually need fonts in illustrations. The problem is that Illustrator uses the PostScript name for fonts, even TrueType fonts, which makes font names unrecognizable by the help viewer. I've had some luck by saving the document as EPS, then manually editing the EPS to correct the font names, then loading the file back into Illustrator, and then doing the WMF export (well, that's convenient). Be careful using Illustrator 9.0 for WMF export, because while it appears to format fonts correctly, it's very likely to turn the font into a bitmap (a design decision which I suppose is rationalized as better than no font at all). Get the 9.0.2 patch, and experiment with Illustrator's export settings to find a compromise that suits you.

Other Drawing Programs
You can also use MS Draw (which is WinWord's built-in picture editor) to place vector drawings directly in the document. This is the most compatible method, but it means the illustrations are not reusable and they cannot have hot-spots. If you must use MS Draw to create WMF, try compiling the pictures into a temporary help file, then decompile the help file to extract the WMF (that's even less convenient than Illustrator for making WMF).

Dynamic Link Libraries

There are many limits to what a help file can do when calling a DLL (Dynamic Link Library). It's a challenge to extend help files without resorting to replacing the help viewer -- in many ways, that's exactly what we do when we create embedded windows.

HPJ Issues
If the [CONFIG] section of your help project file (HPJ) uses very long macros and lots of them, you're likely to have problems. The help viewer (especially the 16-bit help viewer) will crash when loading the help file, or perhaps menu items or keys created by macros will not work.

The first step is to make the macro lines as short as possible. While macros can generally be aproximately 200 characters long, try to keep them shorter than 150 characters.

There is apparently a common memory pool used by the help viewer when starting a help file; temporary storage is at one end, and permanent storage is at the other. We run into problems when temporary storage (the currently-executing macro) overwrites permanent storage (key assignments, menus, and such). Organize items in the [CONFIG] section in the following order to minimize conflicts:

Following this sequence, a help file can execute 30-40 macros when it starts. Keep in mind, however, that macros are interpreted text, not compiled programs, and they run quite slowly; the fewer macros you use when the help file loads, the quicker the help screen will appear.

We can reduce some startup overhead by moving initialization from the HPJ file to the DLL. We can do some initialization within the DLL without even calling it from the help file, by adding code to the DllMain function. DllMain cannot change the appearance of windows, because the windows may not have been created when it loads.

Register Routine Limitations
There is no limit on the number of DLL functions a help file can call, but it's impractical (or sometimes impossible) to use all of the functions we would like.

We can minmize the number of functions in a DLL by having the same function perform several tasks. This is a poor programming practice for general applications, since magic numbers make programs difficult to read and maintain, and prone to errors that are nearly impossible to track-down. In a complex help file, there is no other way. HTMLcat, for example, calls DLL functions more than 2,500 times, but there are only a few functions in the DLL. Designing the function to accept a numeric sub-function number, or a string describing the task, makes it possible to reuse a function, with only a single call to the RegisterRoutine macro.

String Arguments
Say your function requires a file name with a path, so you pass the string from your help file to the DLL, but it never seems to work right. The problem is that some characters are reserved in help files. If, for instance, you need to enter a backslash character, you need to use two of them. Here are the special symbols:

SymbolInterpreted as

\\

Backslash character (\).

\'

Apostrophe (').

\"

Quotation mark (").

These reserved symbols mean that strings will not appear as you want unless you follow these conventions. If the string is delimited by quotation marks and you want a quotation mark in the string, use \"; if it's delimited by apostrophes, but you need an apostrophe in the string, use \':

!MyFunc("This is in \"quotation\" marks")
!MyFunc('This is in "quotation" marks')

Note, too, that there is no way to enter carriage returns and line feeds in the text -- if you try, the help compiler will display the message "Warning 4753: Hidden paragraph," and then quit. You can pass tab characters to functions by placing tabs within the quoted strings.

Strings passed to 16-bit DLLs can be approximately 512 characters long. 32-bit macros can be about 16K long, but the help compiler still limits the length of strings.

Testing DLL Functions
When viewing a help file, you can press CTRL+SHIFT+J to open a small dialog box, then type a keyword, and jump to it. For instance, in HTMLcat, you could type "B" to jump to information on the B tag.

This dialog box simplifies the the task of writing and testing DLLs. Instead of having to write custom text and compile the help file for each test, you can compile just once, making sure the function names are declared in the HPJ, then simply call them. CTRL+SHIFT+J lets you try macros directly by typing "!" followed by the macro name. In HTMLcat, for example, the function named CA() copies text to the Clipboard; this example uses CA():

!CA("Hello, Clipboard.^pThe second line of text.")

Notice that CA() works-around the problem of passing carriage returns and line feeds to DLLs by interpreting "^p" as these characters.

Some DLL functions and macros that depend on the position or state of a window will not work correctly within this pop-up dialog box.

A Sample Problem

When we strive to get more from a technology, we sometimes push it beyond its intended use. Here is a typical scenario.

In HTMLcat 5, we replaced the button bar with a custom navigation bar (tool bar) and live buttons. The navigation bar is managed by the DLL, which tracks the mouse and handles jumps.

When we don't use the BrowseButtons() macro (which would enable the standard button bar), several keys are disabled; for instance, < and > no longer work for navigation, and these keys cannot be re-assigned.

We added a context-sensitive pop-up help topic to the top of every page, with a small "(i)" icon on the navigation bar. When the user clicks the icon, the DLL tells the help file to open a pop-up window (which, itself, requires undocumented code). What if the user doesn't want to use the mouse? We can call the AddAccelerator() macro to assign a macro to the ? key. We would have to change the accelerator on every page in the help file, to ensure that the context-sensitive help topic is used. Or we could call AddAccelerator() once, when the help file loads, and have the macro call the DLL to ask for the current help context. It could look like this:

PopupContext("HTMLCAT.HLP",GetPC())

The GetPC() function in the DLL, returns the current context-sensitive help topic. This method works in 16-bit help files, but the command interpreter in 32-bit help files changed. Arguments to help macros in 32-bit help files cannot contain calculated results from function calls. You can interract with hot keys, embedded windows, and context-sensitive pop-up help windows--we do it all the time in custom help files, but that's a very, very long tale, of dark passages, secret messages, and call-back functions.

Conclusion

This is more information than you wanted, but less than you need. We can see that programs and help files are not magical things that just seem to work without human intervention. They are the result of education, design, and way too much work.

This is all the free help on help we have to offer; it's quite a lot, really. Our consulting services can solve your help file problems and create custom solutions for you.

Notice

© Copyright 2007 R. E. Harvey, All rights reserved.
P.O. Box 10086
Glendale AZ 85318-0086 USA
E-mail: .
Home page: http://ourworld.compuserve.com/homepages/r_harvey.

Use this at your own risk. No liability on my part is implied or stated. I am not responsible if anything or nothing happens for any reason at any time having to do with or not having to do with this information, the help file, the medium upon which it is maintained, or anything else (hereinafter called "thing"). Anything or everything in and about this thing may be inaccurate, misleading or wrong. If you have any problems, just go away. Do not redistribute this thing in any form, electronic or mechanical or cerebral or any other way without the express written permission of me, the author. If you have any problems with or complaints about the terms of this agreement or the quality of this thing, please remove all traces of this thing from your presence, then just go away. Thank you in advance for your cooperation in this ugly matter.

Product and company names mentioned herein are trademarks or registered trademarks or servicemarks, or all of the above, of their respective owners.

And this is all I have to say about that.

Top | Notice | Home | | © Copyright 2007 R. E. Harvey, All rights reserved.