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.
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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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:


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:


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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ensure the Declare statement appears on one line.
dlwulfeAuthor Commented:
Adjusted points to 300
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.
Thanks dlwulfe.

I'm pleased I was able to help you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.