?
Solved

Adding HTML Help to VB6 app

Posted on 2008-10-30
4
Medium Priority
?
856 Views
Last Modified: 2012-05-05
I'm trying to add HTML help to a VB6 app but I'm having no luck. I have a couple of HTML files, which I've compiled with the Microsoft HTML Help Workshop 4.74.8702.0 together with an alias and a header file. I want my VB6 app to be able to display the relevant HTML help file depending on which window the user is in when he hits the F1 key. In my VB6 app, I have the following line of code in the Form_Load event:

App.HelpFile = App.path & "\TMS.chm"  'TMS.chm is the name of the compiled HTML help file

Then for every window in my app, I assign an ID to the HelpContextID property. In my chm help file, I then have two text files, an alias file which looks like this:

IDH_SavingFiles=Saving Files.htm
IDH_OpeningFiles=OpeningFiles.htm
IDH_CreatingANewFile=Creating A New File.htm
etc...

and a header file which looks like this:

#define IDH_SavingFiles 1000
#define IDH_OpeningFiles 1010
#define IDH_CreatingANewFile 1020
etc...

So in one of my VB app's windows, I'll have the HelpContextID set to 1000, on another windows I'll have it set to 1010, on anoter it'll be 1020, etc. However, when I run the app, it doesn't matter which window I'm in. When I hit the F1 key, I get the following error message:

HH_HELP_CONTEXT called without a [MAP] section

The help file then pops up but displays the last help topic - regardless of what window I was on when I hit F1. Any ideas?
0
Comment
Question by:SETP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 1000 total points
ID: 22839353
I've attached the cHtmlHelp.cls class for VB6 (renamed as TXT because EE doesn't allow to upload cls files, so change it's extension before use). This class helps you to manage the use of HTML help files in VB6.

I think that the easiest way that you can use this class is as follows:

1.- In a .bas module, declare a global instance of a cHtmlHelp object:
Public GLOBAL_HELP as New cHtmlHelp
Also, don't forget to set up Help file in earlier inizialization of your app code (form load of your first form or sub main)
GLOBAL_HELP.HelpFile = App.Path & "\TMS.chm"

2.-Set up KeyPreview property of all of your forms in which you want to show context help to True.

3.- In each of those forms, intercept KeyDown event:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then
        GLOBAL_HELP.hWnd = Me.hWnd
        GLOBAL_HELP.DisplayTopic "your_topic_id_here"
    End If
End Sub

Hope that helps.
cHtmlHelp.txt
0
 

Author Comment

by:SETP
ID: 22841290
Thanks RolandDeschain for your reply. I did exactly as you tols me, but when I hot the F1 key, I see the PC does something (the cursor turns to an hourglass for a second), but the help file doesnt appear. Any ideas?
0
 
LVL 7

Assisted Solution

by:help-info
help-info earned 1000 total points
ID: 22842380
One thing I see right away that might be the problem ..
Please avoid SPACE in your filenames and use underscore "_" before compiling a CHM file.

You maybe interested in the following URL's:
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_api.htm#vb6

There is a known problem with MDI applications calling CHM's.

See for VB6 - HTMLHelp (CHM) download example:
http://www.help-info.de/en/Visual_Basic/vb.htm

Best regards
Ulrich Kulle
Microsoft MVP - Help
***********************************
0
 

Author Closing Comment

by:SETP
ID: 31511572
Thanks, that did it
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question