Solved

Call a HTML Help File?

Posted on 2000-03-30
7
147 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…

914 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

20 Experts available now in Live!

Get 1:1 Help Now