Recently, Microsoft's HTML Help Workshop toolkit was used to create a CHM help file, which is summarized as follows:
I. html file preparation before production
Because CHM help files are based on HTML file features, it is important to prepare HTML files in the early stage. Each of its themes is an HTML file,
Topic File
You can use any HTML editor for editing, HTML Help Workshop editing, or Word 97 or
2000.
The topic file is converted to HTML format.
2. Create a project file
Step 1: click the "file/New" command in the menu bar of HTML Help Workshop. The "select new content" dialog box appears, and select "project ".
Step 2: press the "OK" button and leave the "Convert winhelp project" option blank to continue the next step.
Step 3: In the displayed "destination" interface, click the "Browse" button to set the directory where the project file is placed and the project file name, such as test. After that, continue to the next step.
Step.
Step 4: Because the HTML file has been created first, select "HTML file" and continue the next step.
Step 5: click the "add" button and add the edited topic file (that is, the HTML file on the homepage ). Click "Next", and then click "finish"
Button. The new project is added. You can also choose not to add it here, and proceed directly to the next step.
Now you can enter the HTML Help Workshop work window. At the top of the window, there are three volume labels: "project", "contents (directory )",
"Index )".
There are seven buttons on the left side of the project volume. Their function names are from top to bottom: "Change Project"
Options (Change project options )",
"Add/Remove topic files (Add/delete topic files)", "Add/modify
Window definitions (Add/modify window definitions) "," htmlhelp
API
Information (HTML Help API Information), view HTML source (verify HTML source file), save
Project contents and
Index files (saving projects, directories, and index files) "," Save all
File and compile (save all files and compile )".
Step 6: click "Change project" under the "project" editing window.
The Options dialog box is displayed. In this dialog box
Enter the title "test" in the "title" of the general volume.
Help document ". After compilation, this title will appear in the title bar of the CHM File window. Select the file volume
"Automatically create
Contents file (. HHC) when compiling ".
The search option of the CHM file allows users to search for words, words, or phrases in all topic files, display their titles, and display them in a conspicuous way
Topic. In
Select "compiler full-text search information" in the "compiler" volume to support full-text search.
Step 7: click "Save project file and
The compile button, although you can now view the results, but we need to make another setting to make the final product more complete.
3. Create a directory file
Step 1: Click HTML Help
The contents volume label in the workshop work window. A dialog box is displayed, prompting you that the project has no associated directory
(. HHC), select "create
A new contents file ", click" OK "to create a new directory file.
Step 2: specify a new directory file name and storage path. Click "save" and a directory editing window appears. The directory editing window has 11 buttons on the left.
Step 3: insert the title (similar to the directory in the resource manager) or page (similar to the file under a directory in the resource manager) as needed, and press "insert"
The heading (insert title) or insert a page button will pop up "Table of Contents
In the entry title dialog box"
Enter the title of the entry in the input box, select the corresponding topic file as needed, and click
The "add" button under title, in the pop-up dialog box below the "file or URL"
Input box
Select the page opened when the topic is clicked in the Help file. In the dialog box, select a .htm file and click OK.
Step 4: Ask "do
You
Want to insert this entry at the beginningof
The table of contents ?", If "yes" is selected, the Start entry (level 1 entry) will be added.
If "no" is selected, a subentry is added.
Titles can be divided into multiple levels, which should be considered in a unified manner according to the prepared content. If you are not satisfied with the entry, you can use the arrow on the left to adjust it. You can also select the entry and right-click it,
You can also insert titles, themes, or directory files.
4. Create an index file
The index file (HHK) is also an HTML file that contains several keywords. After you open the CHM File, click the index tag and enter a keyword, the CHM File
The list of topics related to this keyword is displayed, so that you can easily find the topics.
Step 1: Click HTML Help
Index in the workshop work window. A dialog box is displayed, prompting you that the "project" is not associated with the index file.
(. HHK), select "Create
New Contents file. Click OK to create a new index file.
Step 2: specify a new index file name and storage path. Click "save" and the index editing window appears. There are 11 buttons on the left of the index editing window.
Step 3: click "insert a keyword" and the "Index" appears.
In the entry dialog box, enter a keyword in the "keyword" input box of the "General" option,
Click "add" to add the topic file associated with the keyword. If you want to skip
Go to another keyword and press the "advance" option in the "index entry" dialog box to select
"Target is another
Keyword, click the "keyword" input box of the "General" option, enter a keyword, and then click the "add" button to add the key to jump
Topic file associated with words,
Click OK. Click "OK" and then press "save file" to save the disk.
5. Final setup
Step 1: Select "project" and click "Change Project"
Options, click "Browse" in the "Content File" project of the "file" volume"
Specifies toc. HHC. In
In the file project, click "Browse" to specify it as index. HHC. In "Default
In file, enter the default Interface when opening the Help file. We can
Input the path of a .htm File
Step 2: click "Save project file and compile" again to compile the disk.
Step 3: click "View/compiled file" on the main menu, and specify the Directory and file name of the CHM file through "Browse" to view the file.
It's really easy enough. If you have a complete HTML source file, activate HTML Help.
Workshop creates a new project file
Default.htmor index.html. Similarly
A group of HTML files, put on the website is a page-by-page web page, into a single CHM
You can use the full-text retrieval feature.
The above describes only the basic steps for creating a CHM help file. However, its functions are far from these. For example, you can insert the HTML Help ActiveX Control, Java
Scripts, pop-up windows, and so on. You can decompress the existing CHM file back to the original HTML file.
6. Call the CHM help file in the application.
In VC:
Method 1: Use shellexcute to open it, just like starting other programs
ShellExecute (null, "open", "test. chm", null, null, sw_showmaximized );
Method 2: Use the htmlhelp function in the HTML Help Workshop SDK
1. Confirm that htmlhelp has been installed and set HTML Help Workshop/include/htmlhelp. h
And HTML Help Workshop/lib/htmlhelp. Lib
Copy the file to the VC project folder and add
Add htmlhelp. H to the Project
2. Add the Code # include "htmlhelp. H" # pragma comment (Lib, "htmlhelp. lib ")
Htmlhelp (m_hwnd, "test. chm", hh_display_topic, 0 );
In C:
Copy the Help file you just created to the DEBUG directory of your C # program, double-click the "help" button in the menu, and add the following code:
Help. showHelp (this, @ "test. chm ");
Then, add a shortcut key F1 for the "help" menu, so that when the program is running, Press F1 to open the Help file.
HTML Help Workshop download: http://msdn.microsoft.com/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp
References: http://topic.csdn.net/t/20020613/16/801118.html
Http://blog.csdn.net/zhangyang0402/archive/2007/05/06/1598512.aspx
Http://blog.csdn.net/afxapi/archive/2004/12/23/226654.aspx