Connecting Context-Sensitive Help to Visual Basic Applications

HelpScribble creates standard WinHelp HLP files and HTML Help CHM files. You can easily connect these to your applications written in Visual Basic 5 and 6 to provide context-sensitive help when the user presses F1. For VB.NET, you need to use the instructions for the .NET framework.

Visual Basic and WinHelp HLP Files

Connecting a WinHelp file to your Visual Basic 5 or 6 application is easy. First of all, you need to specify the help file that you want to use by setting the App.HelpFile property. E.g.: App.HelpFile = App.Path & "\helpfile.hlp"

To make a help window appear when the user presses F1, set the form's WhatsThisHelp property to False. Then set the HelpContextID property of the form to HelpScribble's Topic ID of the topic you want to be displayed. When the user presses F1 while the form is active, that topic will be displayed.

You can also assign Topic IDs to HelpContextID properties of controls on the form. If the user presses F1, and the control that has keyboard focus has a non-zero HelpContextID, then that topic will be displayed instead of the form's topic.

If you want help text to appear in small popup windows rather than in a top-level help window, set the form's WhatsThisHelp property to True. Set the WhatsThisHelpID property of each control of the form to the appropriate Topic ID from HelpScribble.

If you want to show a help topic from within your Visual Basic code, you need to use the WinHelp API call. WinHelp(frmMain.hWnd, App.HelpFile, HELP_CONTEXT, ByVal CLng(1234)) will show the topic that has Topic ID 1234. WinHelp(frmMain.hWnd, App.HelpFile, HELP_FINDER, ByVal 0&) will show the table of contents that you created with HelpScribble's Contents Editor.

You can declare this function with the code Declare Function WinHelp Lib "User32" Alias "WinHelpA" (ByVal hwndApp As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, dwData As Any) As Long or by adding WinHelp.bas to your VB application.

Visual Basic 6 and HTML Help CHM Files

If you are using Visual Basic 6, you can also use .chm files to provide context-sensitive help. First of all, you need to specify the help file that you want to use by setting the App.HelpFile property. E.g.: App.HelpFile = App.Path & "\helpfile.chm"

To make a help window appear when the user presses F1, set the form's WhatsThisHelp property to False. Then set the HelpContextID property of the form to HelpScribble's Topic ID of the topic you want to be displayed. When the user presses F1 while the form is active, that topic will be displayed.

You can also assign Topic IDs to HelpContextID properties of controls on the form. If the user presses F1, and the control that has keyboard focus has a non-zero HelpContextID, then that topic will be displayed instead of the form's topic.

To show a help topic from within your Visual Basic code, you need to use the HtmlHelp API call. To display the topic that has Topic ID 1234 in HelpScribble, simply call: HtmlHelp(frmMain.hWnd, App.HelpFile, HH_HELP_CONTEXT, ByVal CLng(1234))

You can declare this function with the code Public Declare Function HTMLHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, dwData As Any) As Long or by adding HTMLHelp.bas to your VB application.

You Need HelpScribble to Provide Context-Sensitive Help with Your Applications