Solved

Call a HTML Help File?

Posted on 2000-03-30
7
150 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now