jamesbenson
asked on
Button Click -> Execute Help .chm file (VB6)
is there a simple way to open a .chm help file when a button is clicked. I already have it press F1 for help.
This is in VB6
Thx
JB
This is in VB6
Thx
JB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sub command1_click()
dim myhelpfile as str
myhelpfile="c:\helfile.chm "
call ExecuteFile(myhelpfile)
end sub
Public Sub ExecuteFile(FilePath As String)
'Execute a file
On Error GoTo error
Dim ret As Double
ret = Shell("rundll32.exe url.dll,FileProtocolHandle r " & (FilePath), vbNormalFocus)
Exit Sub
error: Error_Handle Err.Description
End Sub
dim myhelpfile as str
myhelpfile="c:\helfile.chm
call ExecuteFile(myhelpfile)
end sub
Public Sub ExecuteFile(FilePath As String)
'Execute a file
On Error GoTo error
Dim ret As Double
ret = Shell("rundll32.exe url.dll,FileProtocolHandle
Exit Sub
error: Error_Handle Err.Description
End Sub
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
WinHelp
Const HELP_COMMAND = &H102&
Const HELP_CONTENTS = &H3&
Const HELP_CONTEXT = &H1
Const HELP_CONTEXTPOPUP = &H8&
Const HELP_FORCEFILE = &H9&
Const HELP_HELPONHELP = &H4
Const HELP_INDEX = &H3
Const HELP_KEY = &H101
Const HELP_MULTIKEY = &H201&
Const HELP_PARTIALKEY = &H105&
Const HELP_QUIT = &H2
Const HELP_SETCONTENTS = &H5&
Const HELP_SETINDEX = &H5
Const HELP_SETWINPOS = &H203&
Private Declare Function WinHelp Lib "user32.dll" Alias "WinHelpA" (ByVal hWndMain As Long, ByVal lpHelpFile As String, ByVal uCommand As Long, dwData As Any) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
WinHelp Me.hwnd, "C:\Windows\help\common.hl
End Sub