INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a
Computer / IT professional?
Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site
(Download This Button Today!)
"...Your site has saved me hours of work that I cannot begin to express my satisfaction..."
Where in the world do Tek-Tips members come from?
Help on help
How to make a HTML help file and integrate it in your VB project
Posted: 26 Jun 02
This FAQ is a 'how to make a HTML help file and integrate it in your VB project' walk through.
1) Create a HTML file. I'll call it main.htm:
<BODY><H2>Main Page</H2><P>Help text</P></BODY></HTML>
2) Open the HTML Help workshop (see FAQ222-1111) and select file -> new -> project
Click 'next' (you don't want to convert a winhelp project) and specify a path & name for you project (.hhp), I'll call it 'HelpFAQ.hhp'. Click 'next' (you don't have any files to include yet). Click 'finish' and the workshop creates a new project.
3) Add the html files to you project. We only have one (main.htm). Files are added by clicking on the 'add/remove topic files' button, click 'add' and select the file.
4) Create a contents file. Click the 'contents' tab and the workshop will promt you to create a new contents file or open an existing. Choose to create a new file. I'll call it 'HelpFAQ.hhc'.
Add headings and files by clicking the buttons on the toolbar to the left. I'll add my main.htm:
- click the 'Insert heading' button (folder icon).
- Click the 'add' button.
- Because we have already added the file to the project (step 3), the title of the html file will appear in the list. Select it and click 'ok'. Enter a title for the heading, I'll call it 'Main Page'. Click 'ok'
5) You are now done with the help project and can compile it to a executable .chm file by clicking the wierd looking 'compile HTML file' on the toolbar at the top. Try it and use explorer to find the compiled file (HelpFAQ.chm), simply double click it to view it.
By clicking the 'project properties' button in the 'project' tab you can set some options. I like to check 'compile full-text search information (compiler tab in options dialog), which gives the help project a 'search' tab.
To integrate the project with a VB program.
6) Make a new 'standard exe' VB program. Select menu project -> properties and browse for you help project in the 'Help file name' box. Click 'ok'. Run the project (F5). Press F1 - voila! you help project is launched from your VB app.
And now for the harder part. You want to make you help project sensitive to the control in focus. The steps below descripes how to make help project open, showing a specific page, when a specific control has focus in you VB project.
7) Add a 2nd file to you help project and add it to your contents file as described in step 3 & 4. I'll call it 'MyTopic.htm'.
8) Create a new text file (use the workshop or an an editor like notepad). The file must have the extension '.h'. I'll call mine 'HelpFAQ.h'. This file contain information that links help topic with helpID in your VB program. Paste the following into the file:
--------------------------------------------- (don't include these lines)
#DEFINE MYTOPIC 1
9) Select the 'Project' tab in the workshop and click the 'HtmlHelp API information' icon on the menu to the left. Click 'header file...' and browse for the header file you created in step 8) (click 'ok'). In the HtmlHelp API information dialog (you should still be there), click the 'Alias' tab. Click 'Add'. Write 'MYTOPIC' (no quotes) in the topmost text box and select the htm file in the combobox below (MyTopic.htm). Click 'ok'. Click 'ok' to get back to the workshop main window. Compile the help file again (you don't need to save the log file if it ask you).
10) Almost there... In your VB project, add 2 textboxes to you form. In the properties of the text2, set the 'HelpContextID' to 1 (the number from the .h file). Run the project. Press F1 and the help project will show with the default page. Close the help project and give focus to text2. Press F1 and the help project will show with the corresponding help page (MyTopic.htm).
11) Done. Remember to get the paths right (and the help file included) if you package your project for deployment.
Tip: All the files (.hhp,.hhc,.h) are text files. When you get the hang of it it is often easier to edit them directly than using the workshop.
Back to Visual Basic(Microsoft): Version 5 & 6 FAQ Index
Back to Visual Basic(Microsoft): Version 5 & 6 Forum
Join Tek-Tips® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
- Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close