• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Help WorkShop - Problem displaying a topic


I created a .hlp help file using Microsoft Help Workshop Version 4.10. I attached it to a Visual Basic program that I wrote using VB 6. I created my own Table Of Contents as the first Topic in my .rtf file as opposed to using a .ctn file for my Table Of Contents.  I mapped all the topics in my help file and used the Topic mapped numbers in my VB program.

My VB program has a menu bar that includes Help. The Help drop down menu includes Contents, Registration and About. It looks like this.
      Help
             Contents
         Registration
           About
I can display my programs “Help Table of Content” when pressing F1 or when I select Help, Contents, from my program’s menu which is what I want to happen.

My problem is when I select Help, Registration, from my programs menu I also get my “Help Table Of Contents”, but I really want the Topic about how to register the program.

I mapped the Table of Contents as 1000, and I mapped the Registration Topic as 1013 in the Help Workshop. In my VB program the menu item called Registration (mnuRegister) was assigned the HelpContentID of 1013 and the main form in my program was assigned the HelpContentID of 1000.

I used the Properties window in VB to assign the HelpContentID’s, but because that didn’t work I also included the following code in the Form_Load procedure:
     Me.HelpContextID = 1000        
     mnuRegister.HelpContextID = 1013

Here is the code associated with Registration on my menu:
      Sub mnuRegister_Click()
         SendKeys "{F1}"
        End Sub

What do I need to do to get the Registration Topic of my help file to display instead of the Table Of Contents when selecting Registration from my menu?

Thanks for the help.
0
dlwulfe
Asked:
dlwulfe
  • 3
  • 2
1 Solution
 
nungaCommented:
Hi

As you have seen, associating the help context ID doesn't work with menus. You can use the Windows API to open any help topic you want.

Include the following code in a module:

***  START  MODULE  CODE  ***

Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Public Const HELP_CONTENTS = &H3&
Public Const HELP_CONTEXT = &H1

***  END  MODULE  CODE  ***

To open the help topic you require, include the following code:

***  START  HELP  EXAMPLES  ***

Sub mnuRegister_Click()

WinHelp Me.hwnd, App.HelpFile, HELP_CONTEXT, 1013

End Sub

Sub mnuHelpContents_Click()

WinHelp Me.hwnd, App.HelpFile, HELP_CONTENTS, 0&

End Sub

***  END  HELP  EXAMPLES  ***
0
 
nungaCommented:
Ensure the Declare statement appears on one line.
0
 
dlwulfeAuthor Commented:
Adjusted points to 300
0
 
dlwulfeAuthor Commented:
Thanks so much. If the help documentation in VB explained this, I sure missed it!!! I increased the points to 300 because your answer was so clear and you gave me code.
0
 
nungaCommented:
Thanks dlwulfe.

I'm pleased I was able to help you.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now