It may be very small but useful for VB developers.

How to Open ‘ ***.chm” file using VB

We can’t open “*.Chm “ just like ****.Hlp file. Because DialogBox can’t open .Chm files.

For Hlp Files

DlOpen.HelpFile = “C\Test.Hlp”
DlgOpen.HelpCommand = cdlHelpContents
DlgOpen.ShowHelp

But for .Chm file

DlOpen.HelpFile = “C\Test.chm”

Will give error.

To Open .Chm fiels we have to use “Win API calls”
The API which we are going to Use is
“ShellExecute(……………………………..)”

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Const SW_SHOWNORMAL = 1

In side the code we have to call this.

Call ShellExecute(Me.hWnd, "open", g_sHelpDir & "\Test.chm", "", 0, SW_SHOWNORMAL)

Regards
Ravi