martin2k

Google
 
Web www.martin2k.co.uk

How do I associate a help file with my program and then call it from a menu?


 

Home

Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here

Contact


 

Question

From: Harry
Date: Thu 02/06/2005 5:25 AM
Subject: Inserting Help File
Question: Hello Sir,
I have created a help file called "wpad.hlp" for my application. How to call that help file when I click Help from Help menu.

Answer by Martin Allen:

The first thing to do is to set the HelpFile property of the App object.  When doing this, you will need to make sure that if the program is located in the root of the drive, that there will not be too many '\' characters in the string:

Dim s As String

s = App.Path

If Len(s) = 3 Then
    App.HelpFile = s & Replace("wpad.hlp", "\\", "\")
Else
    App.HelpFile = s & Replace("\wpad.hlp", "\\", "\")
End If

Now, when the F1 key is pressed, the help file will be displayed.  The code for your Help menu should be:

Private Sub mnuHelpContents_Click()
SendKeys "{F1}"
End Sub

This presses the F1 key virtually, which in turn displays the help file.  There should be no shortcut key for the menu item, which displays the help file as F1 is used to open the help file anyway.


Please fill in the below form if you have any comments or additional information you want to add about the above information.  If you have any Visual Basic 6.0 questions, please visit the ForumAny questions sent using this form will be ignored.

* - Mandatory

*Name: E-mail:

*Comments:

*Please type the following code (your comment will not be accepted without it):


Martin Allen 1999 - 2005.  Last updated Sunday 04 September 2005 02:35:31 PM +0100.