[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Call a HTML Help File?

Posted on 2000-03-30
7
Medium Priority
?
158 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 400 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

868 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