
Newbie needs help running help file
Quote:
>I have created a help file (Help.hlp) and would appreciate it if
>someone could tell me what the syntax is to make it run. Thanks in
>advance. Newbie.
Yep -- this is for the 32bit VB4, it will differ a little if you're
useing the 16bit compiler.
In a global module, place the following in your declaration section:
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
'Then define some constants that may be helpful:
Global Const HELP_CONTEXT = &H1
Global Const HELP_QUIT = &H2
Global Const HELP_INDEX = &H3
Global Const HELP_HELPONHELP = &H4
Global Const HELP_SETINDEX = &H5
Global Const HELP_KEY = &H101
Global Const HELP_MULTIKEY = &H201
To call the above API fuction, select the control on your form that
will be used to activate help. I like a "Help" command button, but
this works for a menu choice, or a button array member, or any other
control you might wish to use.
In the Click Event for the control you choose, place the code:
Dim RV as Long
RV = WinHelp(frmMyForm.hWnd, "c:\helppath\helpfilename.hlp", _
HELP_INDEX, _
CLNG(0))
And that will bring up your help file.
Be sure and attach the following code to the control (button or menu)
that exits your application:
Dim RV as Long
Dim Dummy as String
RV = WinHelp(frmMyForm.hWnd, dummy, HELP_QUIT, 0)
You have to do this because it is quite possible for your end user to
close your program while it's help file is still up and running!
That's because WinHelp.EXE is called be the user32.dll, and of course
it's a seperate program which you do not control.
The other Help Constants are also fun to use, but I'll leave it to you
to experiment with them.
Hope this helps, John