VB6: starting help from code

To add a Help button or menu with help options to your application, you have to add a little VBA code to your application.

Deploying the help: browser based help or CHM file

Before adding the code lies the decision on how to deploy the help. If you choose browser based help you can deploy your application without having to include any help files. If you choose HTML Help (CHM), you are giving your user a better help system. You then have to only include the chm file - not the individual topic (.htm) or other files.

Publishing the browser based help on your website gives you an excellent extra way to promote your application - SEO. You can do this independent of your decision to distribute a chm files with it.
You can import the required modules from the VB6 demo application which you can download from here: vb6_activating_help.zip

Look at the sample code

  1. Download the file vb6 demo application.
  2. Unzip the contents in a folder (e.g. c:\temp\hgvb6demo)
  3. Open the application vb6_activating_help.vbp
  4. In the application there are Forms to show how to call the help, and some modules with supporting code modules and classes which you will need to add to your application.
  5. Open the form frmHelpToolbar in View Code
  6. Scroll to the code from the button which is used to open the Help File with the Index tab selected.

    Private Sub cmdIndex_Click()
        HTMLHelp.OpenIndex Me .HelpFile, Me .hwnd
    End Sub

Do the same with your application

As the demo indicates, there are basically four ways to do the help:

  1. F1 support: see Set Help file and contextId - this behavior should automatically work after you run the Help Generator add-in your VB6 application.
  2. HTML Help (CHM) from a button on your form
  3. HTML Help (CHM) from a button -TOC - index - search
  4. Browser Based Help from a button on your form
Activating help from your application