Wednesday, March 26, 2008

How do I make my HTML Help (.CHM) file look like Windows help files?

If you haven't made HTML Help files before, you will want to obtain Microsoft's HTML Help Workshop, which is a free download from MSDN. When you make a .chm (compiled HTML) help file using the default settings, it will look just like how that HTML would display in Internet Explorer. But if you open up Help Topics in Notepad, you can see that Microsoft uses different fonts. By right clicking and selecting "View Source" you can see that they are actually including a CSS stylesheet from a file called ntshared.chm, which can be found in "C:\Windows\Help". You could link directly to the same file from your help file, but that may be unsafe. Future versions of Windows may move the location of that file, so it will be safer to compile that stylesheet directly into your help file. You can do this using the following steps.
1. Copy C:\Windows\Help\ntshared.chm to the Desktop.
2. Open Microsoft HTML Help Workshop and select Decompile from the File menu.
3. Specify that you want to decompile the copy of ntshared.chm on the Desktop.
4. Copy coUA.css and coUAprint.css from the Desktop to the same directory as your HTML files.
5. Add the CSS link tags to each of your HTML files

<LINK REL="stylesheet" MEDIA="screen" TYPE="text/css"
HREF="coUA.css">
<LINK REL="stylesheet" MEDIA="print" TYPE="text/css"
HREF="coUAprint.css">
Now your help file will have a look that is consistent with Microsoft's own help files.

No comments: