Search Tools Links Login

Implement chm Help in Visual Basic

Posted: 2019-09-25
By: Arthur
Viewed: 215

Filed Under:

VB6 Miscellaneous, VB6 Code Cache

No attachments for this post

Give your app a more polished appearance by using .chm files for your help system.

First place a existing chm File in the project path. You must know what name your htm pages have to work correct.


Option Explicit
Private Declare Function HtmlHelpTopic Lib "hhctrl.ocx" Alias _
    "HtmlHelpA" (ByVal hWnd As Long, ByVal lpHelpFile As String, _
    ByVal wCommand As Long, ByVal dwData As String) As Long

Sub ShowHtmlHelp(ByVal tHelpFile As String, ByVal tHelpPage As String)
    Const HH_DISPLAY_TOPIC =3D &H0
    On Error Resume Next
    ' open the help page in a modeless window
    HtmlHelpTopic 0, tHelpFile, HH_DISPLAY_TOPIC, tHelpPage
End Sub


Put a command button to your form and name it cmdHelp

Private Sub cmdHelp_Click()
    'This is only a example
    ShowHtmlHelp App.path & "\MyHelp.chm", "Introduction.htm"
End Sub

Special Instructions

This code originally appeared on, and has been republished here with the permission of Andrea Tincani.

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.