Easy - Displaying help NOT via F1 key - How? 
Author Message
 Easy - Displaying help NOT via F1 key - How?

Surely this is easy and yet I cannot find how. I want to use a command
button in my application to display my HTML help as if the user had pressed
F1. Only I cannot seem to find what the command it to launch an apps
associated help file.

I assume I could maybe do it by using sendkey command to simulate an F1
call, but surely there is a command to launch the help file at the current
HelpContextID.



Fri, 15 Apr 2005 20:05:00 GMT  
 Easy - Displaying help NOT via F1 key - How?
"Tester" <No Spam Please> wrote in

Quote:
> Surely this is easy and yet I cannot find how. I want to use a command
> button in my application to display my HTML help as if the user had
> pressed F1. Only I cannot seem to find what the command it to launch
> an apps associated help file.

> I assume I could maybe do it by using sendkey command to simulate an
> F1 call, but surely there is a command to launch the help file at the
> current HelpContextID.

Tester,

Here is my module for displaying Help. There are functions for displaying
the Help contents, a specific HelpContextID, and keyword in the Index. It
was written for standard Windows Help files, so I'm not sure if it works
for HTML help.

Regards,
Eric

Option Explicit

' ***********************************************************************
*********************
' * Purpose:    Display application help
' *
' * Inputs:     ContextID:  Help context ID of topic to be displayed
' *             Keyword:    Keyword (or partial keyword) to be displayed
in Index dialog
' *
' * Returns:    N/A
' *
' * Author:     Eric B. Schuyler
' * Revisions:  9/17/99 - Original release
' ***********************************************************************
*********************

Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal
hwnd As Long, _
                                                                ByVal
lpHelpFile As String, _
                                                                ByVal
wCommand As Long, _
                                                                ByVal
dwData As Long) As Long
Const cdlHelpCommand = &H102
' Executes a Help macro
'
Const cdlHelpContents = &H3
' Displays the Help contents topic as defined by the
' Contents option in the [OPTION] section of the .hpj file
' NOTE: cdlHelpContents doesn't work for Help files created
' with Microsoft Help Workshop Version 4.0X.
' Instead, you use the value &HB to get the same effect.
Const cdlHelpCNT = &HB
'
Const cdlHelpContext = &H1
' Displays Help for a particular topic identified by a context number
' defined in the [MAP] section of the .hpj file
'
Const cdlHelpContextPopup = &H8
' Displays in a pop-up window a particular Help topic identified by a
' context number defined in the [MAP] section of the .hpj file
'
Const cdlHelpForceFile = &H9
' Ensures WinHelp displays the correct Help file
' If the correct Help file is currently displayed, no action occurs
' If the incorrect Help file is displayed, WinHelp opens the correct file
'
Const cdlHelpHelpOnHelp = &H4
' Displays Help for using the Help application itself
'
Const cdlHelpIndex = &H3
' Displays the index of the specified Help file
' An application should use this value only for a Help file with a single
index

Const cdlHelpKey = &H101
' Displays Help for a particular keyword.
'
Const cdlHelpPartialKey = &H105
' Displays the topic found in the keyword list that matches the
' keyword passed in the dwData parameter if there is one exact match
' If more than one match exists, the Search dialog box with the topics
found
' listed in the Go Tolist box is displayed
' If no match exists, the Search dialog box is displayed
' To bring up the Search dialog box without passing a keyword, use an
empty string

Const cdlHelpQuit = &H2
' Notifies the Help application that the specified Help file is no longer
in use

Const cdlHelpSetContents = &H5
' Determines which contents topic is displayed when a user presses the F1
key

Const cdlHelpSetIndex = &H5
' Sets the context specified by the HelpContext property as the current
index
' for the Help file specified by the HelpFile property
' This index remains current until the user accesses a different Help
file
' Use this value only for Help files with more than one index

' Opens help file contents
Public Sub HelpContents()
   ' cdlHelpSetContents insures only Contents is displayed (not Index or
Find)
   WinHelp vbNull, App.HelpFile, cdlHelpCNT Or cdlHelpSetContents, 0&
End Sub

' Opens help file to item specified by Help Context ID
Public Sub HelpContext(ContextID As Long)
   WinHelp vbNull, App.HelpFile, cdlHelpContext, ContextID
End Sub

' opens Index dialog with no keyword specified
Public Sub HelpIndex()
   ' pass pointer to NULL string using undocumented StrPtr function
   WinHelp vbNull, App.HelpFile, cdlHelpPartialKey, StrPtr(vbNullChar)
End Sub

' opens Index dialog to specified keyword
Public Sub HelpKeyword(Keyword As String)
   ' pass pointer to string using undocumented StrPtr function
   ' note: string MUST be converted from Unicode!
   WinHelp vbNull, App.HelpFile, cdlHelpKey, StrPtr(StrConv(Keyword,
vbFromUnicode))
End Sub

' opens Index dialog to first match for specified string
Public Sub HelpPartialKeyword(Keyword As String)
   ' pass pointer to string using undocumented StrPtr function
   ' note: string MUST be converted from Unicode!
   WinHelp vbNull, App.HelpFile, cdlHelpPartialKey, StrPtr(StrConv
(Keyword, vbFromUnicode))
End Sub

' displays help on using help application itself
Private Sub HelpOnHelp()
   WinHelp vbNull, App.HelpFile, cdlHelpHelpOnHelp, 0&
End Sub



Fri, 15 Apr 2005 21:50:10 GMT  
 Easy - Displaying help NOT via F1 key - How?

<SNIPPED>

Errr, I really was hoping it would be easy to call the help system from
code. Is this the only way to do it, therefore through the API code you have
shown. Surely MS put some easy way to call the help file like the user
pressed F1.

Open to more suggestions on this topic which appears not to be so Easy after
all.

Regards,



Sat, 16 Apr 2005 00:17:14 GMT  
 Easy - Displaying help NOT via F1 key - How?

Quote:


><SNIPPED>

>Errr, I really was hoping it would be easy to call the help system from
>code. Is this the only way to do it, therefore through the API code you have
>shown. Surely MS put some easy way to call the help file like the user
>pressed F1.

>Open to more suggestions on this topic which appears not to be so Easy after
>all.

Look up the WinHelp API in the MSDN for usage.
As an example.. here is the windows calculator help.
Call WinHelp(Me.hwnd, "calc.hlp", HELP_CONTENTS, 0)

--
Regards, Frank



Sat, 16 Apr 2005 06:31:55 GMT  
 Easy - Displaying help NOT via F1 key - How?

Quote:
> I want to use a command button in my application to display my HTML help
> as if the user had pressed F1.

I'm not sure if it will help, but you may get some pointers from
http://www.smountain.com/resource/VBHTMLHelp.pdf -- which is probably
the most detailed resource available anywhere on how to connect HTML
Help to VB applications.

Some other useful pages that may help are:

http://www.mvps.org/htmlhelpcenter/classmod.htm
http://www.mvps.org/htmlhelpcenter/whcomplete.htm
http://helpware.net/FAR/far_faq.htm#VBandHH

Samples of VB applications + HTML Help:

http://www.mvps.org/htmlhelpcenter/sample.htm
http://www.helpcommunity.ehelp.com/robohelp/downloads/htmlhelp/

Pete



Sat, 16 Apr 2005 09:16:47 GMT  
 Easy - Displaying help NOT via F1 key - How?

Quote:

> Here is my module for displaying Help. There are functions for displaying
> the Help contents, a specific HelpContextID, and keyword in the Index. It
> was written for standard Windows Help files, so I'm not sure if it works
> for HTML help.

Hi Eric / All,

I checked out your module and it seems OK. I also looked at the other
postings regarding help and all are useful. However, despite reading what
seems to be many different documents from different sources, I am still
slightly confused. My main points of confusion are the following,

1* I installed Microsoft's HTML Help Workshop to create my HTML help files
(Not the actual HTML files of course but their structure etc.). This seems
buggy as it crashes quite a lot (V4.74.8702.0 according to "Version..."
although when I downloaded I swear it said version 1.3).  Therefore my first
query is, am I using the best tool to create a good modern HTML file? Are
there actually any other tools available?

2* When I compiled my first test HTML help file, it created a file
called "TestHelpProject.chm". Note the chm file extension and this is listed
in Windows Explorer as a "Compiled HTML HelpFile".
My confusion arises from the fact that the Winhelp API command does not seem
to like my chm file and only works with .hlp files.
When I try and use the chm file I get the following error, "The C:\My
Docs\TestHelpProject.chm file is not a Windows Help File, or the file is
corrupted."

I know the file is not corrupt because when I press the F1 key, it opens
fine. (Also I can double click it in Windows Explorer and it also opens
fine)

What I am doing wrong or how do get the HTML Help workshop to produce .hlp
files rather then .chm or how do I get .chm files to be called from Winhelp?

Any help on these matters is greatly appreciated.



Mon, 18 Apr 2005 01:55:47 GMT  
 Easy - Displaying help NOT via F1 key - How?

Quote:

> 1* I installed Microsoft's HTML Help Workshop to create my HTML help files
> (Not the actual HTML files of course but their structure etc.). This seems
> buggy as it crashes quite a lot (V4.74.8702.0 according to "Version..."
> although when I downloaded I swear it said version 1.3).

Each HTML Help component has its own version number which,
confusingly, doesn't really correspond to the version number of HTML
Help itself.

http://helpware.net/htmlhelp/hh_info.htm#FileVersionInfo

You're right that there are quite a number of bugs in HTML Help
Workshop. There is very little chance that these will ever be fixed,
as help development at Microsoft is now concentrating on the Microsoft
Help 2.0 format (.HxS) rather than HTML Help 1.x (.chm).

Quote:
> Therefore my first query is, am I using the best tool to create a good modern
> HTML file?

In my experience, most Help Workshop crashes occur when you are
editing one of the project files (.hhp, .hhc, .hhk). The best
workaround I can suggest is that you try editing these files with FAR
(http://helpware.net/FAR/index.html), which is a much more stable and
feature-rich program than HTML Help Workshop. You can use FAR for free
for a couple of months, and then you must pay a nominal fee to
register the program.

Quote:
> Are there actually any other tools available?

Dozens. You can spend a lot of money on "bells and whistles" tools
that simplify and streamline the process of creating help files.
Before you do so, it would be worth trying out a few
freeware/shareware tools, available from http://www.helpmaster.com.
Then, if you decide to buy one of the more expensive tools, check out
these resources:

Tools Comparison Matrix:
http://www.helpstuff.com/downloads/toolsv5.pdf (Acrobat 5 format)
http://www.helpstuff.com/downloads/toolsv4.pdf (Acrobat 4 format)

Which Help Authoring Tool(s) Do You Choose?
http://www.helpstuff.com/downloads/HATcomparison.ppt

Review of RoboHelp Office 2002:
http://www.winwriters.com/robohelp02_pt1.htm

Review of Doc-To-Help 6.0:
http://www.winwriters.com/dth6.htm

FWIW, RoboHelp is the most popular authoring tool, but it is
*constantly* bashed in the forums frequented by help authors (e.g.,
http://groups.yahoo.com/group/HATT).

Quote:
> how do get the HTML Help workshop to produce .hlp files rather then .chm

You can't; HTML Help Workshop creates.chm files only. If you want to
build a WinHelp (.hlp) files, use the WinHelp Workshop, available
from:

http://www.helpmaster.com/hlp-developmentaids-hcw403.htm

That said, can't you just use the HTML Help API rather than the
WinHelp API? The resources I mentioned in my previous message will
show you how to do this.

Finally, for help-related questions, have a look at the
microsoft.public.helpauthoring newsgroup.


Pete



Mon, 18 Apr 2005 19:17:31 GMT  
 Easy - Displaying help NOT via F1 key - How?
Tester

Go to http://www.mvps.org/htmlhelpcenter/

regards

Ian

** invalid email address, change dk to denmark

Tips & Tricks page http://tips.kingsoft-denmark.com/



Quote:


> > Here is my module for displaying Help. There are functions for
displaying
> > the Help contents, a specific HelpContextID, and keyword in the Index.
It
> > was written for standard Windows Help files, so I'm not sure if it works
> > for HTML help.

> Hi Eric / All,

> I checked out your module and it seems OK. I also looked at the other
> postings regarding help and all are useful. However, despite reading what
> seems to be many different documents from different sources, I am still
> slightly confused. My main points of confusion are the following,

> 1* I installed Microsoft's HTML Help Workshop to create my HTML help files
> (Not the actual HTML files of course but their structure etc.). This seems
> buggy as it crashes quite a lot (V4.74.8702.0 according to "Version..."
> although when I downloaded I swear it said version 1.3).  Therefore my
first
> query is, am I using the best tool to create a good modern HTML file? Are
> there actually any other tools available?

> 2* When I compiled my first test HTML help file, it created a file
> called "TestHelpProject.chm". Note the chm file extension and this is
listed
> in Windows Explorer as a "Compiled HTML HelpFile".
> My confusion arises from the fact that the Winhelp API command does not
seem
> to like my chm file and only works with .hlp files.
> When I try and use the chm file I get the following error, "The C:\My
> Docs\TestHelpProject.chm file is not a Windows Help File, or the file is
> corrupted."

> I know the file is not corrupt because when I press the F1 key, it opens
> fine. (Also I can double click it in Windows Explorer and it also opens
> fine)

> What I am doing wrong or how do get the HTML Help workshop to produce .hlp
> files rather then .chm or how do I get .chm files to be called from
Winhelp?

> Any help on these matters is greatly appreciated.



Sun, 24 Apr 2005 14:51:55 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Menu item shorcut key F1 not working

2. Disable F1 context help via API?

3. Showing custom Help by pressing the F1 key

4. Help context ID and F1 key

5. Help on F1 key

6. Help on F1 key

7. F1 key access to HTML help

8. Help on F1 key

9. Help on F1 key

10. What messages with F1 help key?

11. Display MY help window when F1

12. Displaying F1 help from control

 

 
Powered by phpBB® Forum Software