Solved

Call a HTML Help File?

Posted on 2000-03-30
7
145 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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