Fog Creek Software
Discussion Board




Displaying Help from VB?

I'm wondering how you display a .chm file from VB.  I simply want to display the file when the user clicks help on the menu.

I have set the App.HelpFile property, but pressing F1 still does nothing.  Trying to load it via CommonDialog.ShowHelp does not work either.

I have searched google, but most of the examples say talk about context sensitive help and setting context ID's in the Help workshop.  I don't want that, I just want to display the help file the same way it does when you double click on it.  Maybe I have to define context ID's anyway?  I'll play around with that maybe.

Any tips would be appreciated.


Thursday, January 15, 2004

> I just want to display the help file the same way it does when you double click on it

That sounds like a job for Win32 API function called ShellExecute

Christopher Wells
Thursday, January 15, 2004

http://vbnet.mvps.org/index.html


Thursday, January 15, 2004

Thanks Christopher.


Thursday, January 15, 2004

This is what you want:  http://www.mvps.org/htmlhelpcenter/htmlhelp/hhobjlib.html

It's a compent that simplifies the process and allows you to do anything you want with CHM or HLP files.

Setup is simple:

Set moHelp = New hlpobj40.HTMLHelp
moHelp.CHMFile = gsAppPath & HELP_FILE

When you want to show a topic by Context ID:

With moHelp
        .HHTopicID = EAHlpCtx_Intro
        If lHwndOwner > 0 Then
            .HHDisplayTopicID lHwndOwner
        Else
            .HHDisplayTopicID
        End If
End With

NOTE: You MUST call moHelp.HHClose before leaving your application or there is a GPF!

Also, it's recommended that you don't create the help object until the first time that the help is needed.

Wayne
Thursday, January 15, 2004

*  Recent Topics

*  Fog Creek Home