Website Design United States, Website Design California, Website Designing United States, Website Designing California

Launch HTML Help, loading a specific help topic - Visual Basic 6

Launch your CHM (HTML Help file) calling a specific topic... or your Table of Contents...

Option Explicit

Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_HELP_CONTEXT = &HF

Public Declare Function HtmlHelp Lib "Hhctrl.ocx" Alias "HtmlHelpA" (ByVal hWndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long

Public Sub CallHelp(lWnd As Long, lContext As Long)
'lWnd is the Window Handle of the form that you want to assign the Help to.
'If you close this form, then you will automatically close help.

'lContext is the context number that you want called. This is determined
'by the program you used to compile your HTML help file.
Dim lR As Long

If lContext = 0 Then 'Are we launching just the help file, or a specific topic?
lR = HtmlHelp(lWnd, "C:\MyHelp.chm", HH_DISPLAY_TOPIC, 0)
lR = HtmlHelp(lWnd, "C:\MyHelp.chm", HH_HELP_CONTEXT, lContext)
End If
If lR = 0 Then 'Either the Topic did not exist, or the launch failed.
MsgBox "Unable to launch HTML Help," & vbCrLf & "or the topic you requested does not exist"
End If
End Sub

42 B Malviya Nagar , New Delhi-110017

Skype: manmeetsi
Tel: 91-011-40502005, 9810067295



© 2008-2009