Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Helpless with HtmlHelp API

Status
Not open for further replies.

huggybear

Technical User
Feb 15, 2001
83
US
Hello out there,

Has any one been able to successfully use the html help API to make help topics available to users?

I've followed the directions as given in the Microsoft Office 2000 Visual Basic Programmer's Guide that comes with the developer's tools. However, when I run the code, I get an error message stating that there is no entry point for my function in the HHCtrl.ocx dll.

Also, the HtmlHelp function is not listed among the API functions in the API add-in, so I can't check to see if there may be a typo in the book.

So, has any one ever got this to work? If so, can you please tell me the correct function declarations and any references that need to be set?

Thanks in advance, Bear
 
Hey huggy! :)

I've been using this for a while now ... here's what I did to make it work:

Created a separate module with the following code:

'declare the HtmlHelp function and all of it's constants
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

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
Const HH_HELP_CONTEXT = &HF
Const HH_TP_HELP_CONTEXTMENU = &H10
Const HH_TP_HELP_WM_HELP = &H11

Public Sub Help_Display(hwnd As Long)
'subroutine written by Greg Tammi for ATS 07/10/2002
'subroutine is designed to open the .chm file for this database. hWnd is a variable (Long) which
'represents the window handle which is parent for this help file
'declare variable to hold window handle of created help window
Dim hwndHelp As Long
'open the help file; value of created window stored in hwndHelp
hwndHelp = HtmlHelp(hwnd, "Z:\Help Files\TestHelp.chm", HH_DISPLAY_TOPIC, 0)
End Sub

OK - hard part's over ... here's how you call the help function from code - I use a command button ...

'declare variable to hold the window ID of the current window
Dim lWindowID As Long
lWindowID = Screen.ActiveForm.hwnd 'assign current windowID to lWindowID
Call Help_Display(lWindowID) 'call custom designed subroutine to open help

Ta-da! All Finished ...

HTH

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top