Solved

Call a HTML Help File?

Posted on 2000-03-30
7
153 Views
Last Modified: 2010-05-02
I have created a CHM File using HTML Help Workshop. I now need to call this from a VB App using for example a help button. How do i do this?
0
Comment
Question by:hutchison
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 4

Accepted Solution

by:
gcs001 earned 100 total points
ID: 2671078
You just need to specify the Help File name to the App object as in ...
App.HelpFile = "C:\MyHelpFile.s\chm"
As soon as the user presses F1 this help file will open up.
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2671079
You just need to specify the Help File name to the App object as in ...
App.HelpFile = "C:\MyHelpFile.s\chm"
As soon as the user presses F1 this help file will open up.
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2671083
Sorry, that should read
App.HelpFile = "C:\MyHelpFile.chm"
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 7

Expert Comment

by:BarryTice
ID: 2671214
I'm lazy, hutchison, and I'm writing my help files in straight html.

I use shellexecute to launch the buggers. That means I don't get any of the benefits of context IDs, or any of that kind of good stuff. But I don't have field-level help anyway

It looks like gcs001's solution might be handy, though, as it enables invoking the file with the <F1> key. But you can use shellexecute behind a button to get the html file to open in a web browser.


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

Public Command1_Click()

Dim lngCmd as Long
Dim lngRet as Long
Dim strFile as String
Dim strPath as String

strFile = "MyHelpFile.chm"
strPath = "C:\Folder1\Folder2\"

lngCmd = 1     'Mode of opening the window, not minimized, in front
lngRet = ShellExecute (me.hwnd, "Open", strFile, "", strPath, lngCmd)





Of course, I know nothing about chm files, but it works with html, opening the file in the registered browser.
0
 
LVL 7

Expert Comment

by:BarryTice
ID: 2671219
Oh, don't forget your End Sub after the ShellExecute call. But you knew that.
0
 
LVL 7

Expert Comment

by:BarryTice
ID: 2671224
And, um, that's Public Sub Command1_Click(). That's what happens when you write code in a web browser window rather than writing it in VB and pasting it in.
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2671312
Here is  code you can use to call up the HTML .CHM help file if the user clicks a button ...

Add to your module section:
Public Const HH_DISPLAY_TOPIC = &H0
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 = &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.

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



Add to you Command1 or menu section:
Private Sub Command1_Click()
Dim hwndHelp As Long
'The return value is the window handle of the created help window.
hwndHelp = HtmlHelp(hwnd, App.HelpFile, HH_DISPLAY_TOPIC, 0)
End Sub


Remember to set your App.HelpFile to the correct .CHM file!

Regards,
Grant.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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