Help with help files

How do you put the help files in a menu option in vb.  I have made the help file but i do not know how to put them on the form so that when the user clicks on the help menu option it pops up the contents of help.  if someone can help or maybe give me a sample program that would be great. thanks

jen
nrok829Asked:
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.

cwreaSoftware CraftsmanCommented:
First, in your VB project's properties (from the Project menu, choose Properties) on the General tab, there is a setting called "Help File Name". Point it to the help file you created.

Next, assuming your help file has context IDs defined, set the context ID for each control and menu item in your form.  When the user has selected one of these controls then presses F1, your help file should be loaded and displayed at the proper context.

If you don't set a HelpContextID for the control, it will open up the help file at the main contents.

In your application, you can also directly launch help by calling the WinHelp API function.  Here's a code snippet from KnowledgeBase article Q202563 on how to call WinHelp from VB:

   Option Explicit
   
   Private 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

   Private Const HELP_CONTENTS = 3
   Private Const HELP_FINDER = 11

   Private Sub Command1_Click()
      Dim lResult As Long
      Dim sHelpFile As String
      Dim lCommand as Long, lOption as Long
      sHelpFile = "winfile.hlp"
      lCommand = HELP_CONTENTS
      lOption = 0
      lResult = WinHelp(Me.hwnd, sHelpFile, lCommand, lOption)
   End Sub



For more information on using the help system with Visual Basic I suggest looking for the word "winhelp" in MSDN (either CD or online at http://msdn.microsoft.com)


0

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
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.