Help Files chm

Hazey Daze
06-20-2002, 06:44 AM
Hi,

I have just converted my hlp file to a chm help file and I am not sure how I run this from visual basic can anyone help?

Thanks

Hazey Daze

Wamphyri
06-20-2002, 07:04 AM
You can use the HtmlHelp API.

-Carl

ChiefRedBull
06-20-2002, 07:11 AM
HtmlHelp

Hazey Daze
06-20-2002, 08:05 AM
How does HTMLHElP work, I have declare it in my global variable, and have

return_value = htmlhelp(0,app.helpfile,HH_DISPLAY_CONTEXT,0)

it does not recognise HH_DISPLAY_CONTEXT??

Wamphyri
06-20-2002, 08:07 AM
here is an example from the api guide

[code]
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.
Const HH_CLOSE_ALL = &H12
Private 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
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim hwndHelp As Long
'The return value is the window handle of the created help window.
hwndHelp = HtmlHelp(hWnd, "myfile.chm", HH_DISPLAY_TOPIC, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
HtmlHelp Me.hWnd, "", HH_CLOSE_ALL, 0
End Sub
[code]

ChiefRedBull
06-20-2002, 08:48 AM
Apologies, I should've read the question. You don't need that API, just ShellExecute:
Option Explicit

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

Private Sub Form_Load()

ShellExecute Me.hwnd, "open", "FilePathToHelp.chm", vbNullString, "c:", 1
End Sub

Thinker
06-20-2002, 04:57 PM
If you want to direct the HTMLHELP to open a particular topic in
the .CHM file, you do have to use the API, otherwise Chief is
correct.

BTW, there is a nasty bug when using the API on NT computers.
There is an API call you have to make to be sure everything is
shutdown correctly or it will fault when the program closes.
Check out what I posted here...
http://www.visualbasicforum.com/showthread.php?s=&threadid=29039

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum