HtmlHelp stopped working

Posted on 2004-11-20
Last Modified: 2013-12-25
For some reason, calling HtmlHelp has stopped working. Here
are some code snippets.  Any suggestion where to look will
be greatly appreciated. Code for WinHelp is also included
in case it interferes with htmlHelp (unlikely). WinHelp works fine.
Note:  HtmlHelp worked fine until I had a fatal HD failure and had
to restore from backup tapes.  Some of the code had to be rebuilt,
including this part. I could have easily done something wrong that
I cannot see.  

'*****************Code Snippets Follow*****************************
'Setting the help path in Sub Main:

   sHelpFile = App.Path & "\TSEPWin.hlp"
    HelpPath = App.Path & "\TSEPWin.chm"
    If osinfo.dwPlatformId = 1 And osinfo.dwMinorVersion = 0 Then
        UserInfo.HtmlHelp = False
        App.HelpFile = sHelpFile
        GoTo FinishHelpPath
    End If
    If UserInfo.HtmlHelp = False Then
        App.HelpFile = sHelpFile
        App.HelpFile = HelpPath & vbNullChar
    End If
    Load frmSplash
'Code from the HelpAndQuery module

      Public Const HH_DISPLAY_TOPIC As Long = 0
      Public Const HH_SET_WIN_TYPE = &H4
      Public Const HH_GET_WIN_TYPE = &H5
      Public Const HH_GET_WIN_HANDLE = &H6
      Public Const HH_DISPLAY_TEXT_POPUP = &HE      ' Display string resource ID or
                                                    ' text in a pop-up window.
      Public Const HH_HELP_CONTEXT As Long = &HF            ' Display mapped numeric value in
                                                    ' dwData.
      Public Const HH_TP_HELP_CONTEXTMENU = &H10    ' Text pop-up help, similar to
                                                    ' WinHelp's HELP_CONTEXTMENU.
      Public Const HH_TP_HELP_WM_HELP = &H11        ' text pop-up help, similar to
                                                    ' WinHelp's HELP_WM_HELP.

               Public Const HELP_CONTENTS = 3
               Public Const HELP_FINDER = 11

' Public variables
      Public lResult As Long
      Public sHelpFile As String
      Public lCommand As Long, lOption As Long
      Public HelpPath As String
      Public hwndHelp As Long


    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
    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

'Typical call:

   On Error GoTo ErrHandler
    If UserInfo.HtmlHelp = True Then
        hwndHelp = HtmlHelp(hwnd, HelpPath, HH_DISPLAY_TOPIC, 1000)
        lOption = 1000
        lResult = WinHelp(Me.hwnd, sHelpFile, lCommand, lOption)
    End If

    Exit Sub
'**********************End of Code Snippets**************************
Question by:rkulp
    LVL 22

    Accepted Solution

    Your code works here although I don't have TSEPWin.chm so changed code to:
    Public Sub LoadHelp(ByVal hWnd As Long, ByVal HelpPath As String)
       hwndHelp = HtmlHelp(hWnd, HelpPath, HH_DISPLAY_TOPIC, 0)
    End Sub

    If that doeswn't work you can also try one of the following:
    1. Manually register hhctrl.ocx(located in Windows\System32) using RegSvr32.
    2. Reinstall HelpWorkshop from scratch.
    LVL 22

    Expert Comment

    Also make sure you file App.Path & "\TSEPWin.chm" is indeed present and loads properly by DblClick in File Explorer .
    LVL 1

    Author Comment

    Changing the call did not help.  The earlier version runs both help formats fine so hhcrtl.ocx is OK.  The last version was compiled under Windows 2000 and this is under Windows XP SP 2a.  Most of my user's problems and all the compiler questions came with service pack 2.
    LVL 1

    Author Comment

    Please consider this question closed.  The problem was solved by two items:

    1. Adding the following declare and load statement

    Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal
    lpLibFileName As String) As Long

      LoadLibrary "hhctrl.ocx"

    These items solved an error code received when the program ended.  

    2.  Changing the call to use HH_HELP_CONTEXT instead of HH_DISPLAY_TOPIC

    These corrections were suggested by a Microsoft VB Team consultant.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now