Solved

html help

Posted on 2002-06-25
5
208 Views
Last Modified: 2010-05-02
Hi
I have chm help file compiled from 2 html pages (pageA, pageB).
I have simple app in VB with 2 forms (frmA and frmB).

What can I do to associate pageA with frmA and pageB with frmB, so if user push F1 on form can get appropriate html page ?

I try do this:
1. set path to chm file in app project property.
2. set HelpContextID on each form to unique value (frmA: 1001, frmB: 1002);

What can i do with chm help file to associate this values with proper html page ?

Alex
0
Comment
Question by:apsoft
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7106836
Perform the following steps in your Visual Basic application:


Create a new project, Form1 is created by default. Add a few controls to the form.


Add a module to the project, and add the following constants to the declaration section of the module:


      Public Const HH_HELP_CONTEXT = &HF

      Public Const MYHELP_FILE = "myfile.chm"
 
NOTE: "myfile.chm" is the path and name of the HTML Help file (.chm) you created earlier.


Add the following HTML Help API declaration to the module:



      Public Declare Function HtmlHelpLongArg Lib "hhctrl.ocx" _
          Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
          ByVal pszFile As String, ByVal uCommand As Long, _
          ByVal dwData As Long) As Long
 
Intercept the form's KeyUp method to capture the F1 key using the following sample code in the Form KeyUp event procedure:



      Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
         dim iRetCode As Long
         If KeyCode = vbKeyF1 Then
             iRetCode = HtmlHelpLongArg(Me.ActiveControl.hWnd,_
              MYHELP_FILE,HH_HELP_CONTEXT,Me.ActiveControl.HelpContextID)
         End If
      End Sub
 
Set the form's KeyPreview, WhatsThisHelp, and WhatsThisButton properties to TRUE.


Set the HelpContextID property of each control on the form to a value from the help project file's MAP section.


Run the Visual Basic application. Select a control on the form and press the F1 key. The appropriate context-sensitive help topic should appear on the screen.
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7107767
Isn't it as simple as associating PageA with "1001" and PageB with "1002" in the CHM file itself?

So long as App.HelpFile = "path to CHM file" and each HelpContextID is set to 1001 etc then F1 works without any other code.
0
 

Author Comment

by:apsoft
ID: 7109867
I belive it is as simple as associting HelpContextID in form with proper number.
But my question is: how can i associate this number with proper topic in chm file ????

Can you explain with details this job ?
Alex
0
 
LVL 3

Accepted Solution

by:
PNJ earned 100 total points
ID: 7109978
It depends on what Help compiler you're using. There has to be a way in it to associate the help topic number with a page.

If you don't have a help compiler and you're using an existing CHM file over which you have no control then you cannot do this. You would have to know what topic numbers are ALREADY associated with the CHM pages.

This is the link to the code given by roshmon: http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q189086 and this link gives a bit more info about compiling CHM file: http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q242433
0
 

Author Comment

by:apsoft
ID: 7110247
"How to Create Context Sensitive HTML Help Files (Q242433)" is the document i need!
Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 …
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…
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…

762 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

24 Experts available now in Live!

Get 1:1 Help Now