Quantcast
Viewing all articles
Browse latest Browse all 21180

[RESOLVED] Linking help file topic to button event

I just don't seem to be able to grasp how to do this using VB6. I've tried at least 6 methods I've found on the net but I get different errors with each one or nothing happens. The program is an MDI app. Getting F1 to open the chm file is simple and working to a point ... but I cannot get the desired individual topic even if I set the HelpContextID on the child form. It always brings up the last page in the help that I viewed.

Here's the code I got from MS that I placed in a module:
Code:

Public HelpFile As String  ' path to help file set in main screen on startup

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

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

The click event for a button on a form runs this code. I'm looking for topic # 60:
Code:

Dim hwndHelp As Long

hwndHelp = HtmlHelp(hWnd, HelpFile, HH_DISPLAY_TOPIC, 60)

Which results in a error that HH_DISPLAY_TOPIC is undefined. Except that I thought it was defined as a constant in the module above.

The more I fiddle with this the more lost I seem to get ... yet I think I'm close. Can someone set me straight while I still have a little hair left and sanity is still recoverable?

TIA
Ken

Viewing all articles
Browse latest Browse all 21180

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>