WebHelp Pro is an uncompiled output type that is RoboHelp Server-based and supports standard Help features (such as TOC, index, and search). A browser is not required to view the output. In addition, WebHelp Pro provides end-user feedback reports on how people are using your system and other features available only with RoboHelp Server. WebHelp Pro projects require RoboHelp Server for context-sensitive Help.
An ASP file is included for viewing content. The default hyperlink is http://<RoboHelp Server>/Roboapi.Asp. You can pass a parameter to the ASP file:
•project=Project_Name
•context=MapNumber
•url=URL
For example:
•This URL displays default content from the server: http://<RoboHelp Server>/Roboapi.Asp
•This URL displays the project_name project (merged with any other projects): http://<RoboHelp Server>/robohelp/rest/search?project=<project-name>&quesn=<search-query>
•This URL displays content for map number 101: http://<RoboHelp Server>/ /robohelp/rest/robowindow?wtype=ctx&context=<id>&project=<project name>
When opening context-sensitive WebHelp Pro from a browser, use the context-sensitive Help API and support files.
Use this information to connect context-sensitive WebHelp or WebHelp Pro topics to Visual Basic applications.
The sample code here uses a function called Showhelp that opens a local or remote topic regardless of the browser type.
The ShowHelp function has two parameters: strTopic takes a URL or local filename as a value, and bIsLocal takes a Boolean value. It indicates whether the first parameter is a local filename (TRUE) or remote URL (FALSE). If the file is local, ShowHelp tells the browser to find the file in the Help subfolder of the application folder.
Public Function ShowHelp(strTopic As String, _
bIsLocal As Boolean) As Boolean
Dim strDir As String
If bIsLocal Then
' Get registry entry pointing to Help
strDir = App.Path + "\Help\"
End If
' Launch topic
Dim hinst As Long
hinst = ShellExecute(Me.hwnd, vbNullString, _
strTopic, vbNullString, _
strDir, SW_SHOWNORMAL)
' Handle less than 32 indicates failure
ShowHelp = hinst > 32
End Function
To call ShellExecute , declare the function. For example:
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
The ShowHelp function requires an explicit filename or URL. But for context-sensitive Help, it is better to code the application to use context IDs rather than explicit topic names. Use the following sample function, ShowHelpContext, which maps integer context IDs to topic name strings, then calls ShowHelp to launch the topic.
Public Function ShowHelpContext(nContextId As Integer) As Boolean
Dim strTopic As String
Dim bIsLocal As Boolean
bIsLocal = True
Select Case nContextId
Case HH_GADGET_DIALOG
strTopic = "gadget.htm"
Case HH_WHATSIT_DIALOG
strTopic = "whatsit.htm"
Case HH_WIDGET_DIALOG
strTopic = "widget.htm"
Case HH_TECH_SUPPORT:
strTopic = "http://www.mycompany.com"
bIsLocal = False
Case Else
strTopic = "unknown-context.htm"
End Select
ShowHelpContext = ShowHelp(strTopic, bIsLocal)
End Function
..............................................................................................................................................
Using ShowHelpContext makes maintaining context-sensitive Help much easier because, if a topic name changes, only one function must be modified. Declare context IDs (for example,HH_GADGET_DIALOG) as constants that can be shared among the program modules that use context-sensitive WebHelp or WebHelp Pro.
Const HH_GADGET_DIALOG As Integer = 1
Const HH_WHATSIT_DIALOG As Integer = 2
Const HH_WIDGET_DIALOG As Integer = 3
Const HH_TECH_SUPPORT As Integer = 4
note: This information is for developers who must connect context-sensitive WebHelp and WebHelp Pro topics to Visual C++ applications.
The sample code provided here uses a function called ShowHelp that opens a local or remote topic regardless of the browser type.
The ShowHelp function has two parameters: szTopic takes a URL or local filename as a value, and bIsLocal takes a Boolean value. It indicates whether the first parameter is a local filename (TRUE) or remote URL (FALSE). If the file is local, ShowHelp tells the browser to find the file in the Help subfolder of the application folder.
BOOL ShowHelp(LPCTSTR szTopic, BOOL bIsLocal)
{
TCHAR szDir[MAX_PATH] = "";
if (bIsLocal)
{
// Get directory of application
DWORD dw = GetModuleFileName(AfxGetInstanceHandle(), szDir, MAX_PATH);
TCHAR* pchEnd = _tcsrchr(szDir, '\\') + 1;
ASSERT_POINTER(pchEnd, TCHAR);
*pchEnd = '\0';
// Append subfolder name
_tcscat(szDir, _T("Help"));
}
// Open topic
HINSTANCE hinst = ShellExecute(NULL, //no parent hwnd
NULL, // open
szTopic, // topic file or URL
NULL, // no parameters
szDir, // folder containing file
SW_SHOWNORMAL); // yes, show it
// handle less than 32 indicates failure
return hinst > (HINSTANCE)32;
}
.......................................................................................................................................
The ShowHelp function requires an explicit filename or URL. But for context-sensitive Help, it is better to code the application to use context IDs rather than explicit topic names. Use the following sample function, ShowHelpContext, which maps integer context IDs to topic name strings, then calls ShowHelp to open the topic.
BOOL ShowHelpContext(int nContextId)
{
CString strTopic;
BOOL bIsLocal = TRUE;
switch (nContextId)
{
case HH_GADGET_DIALOG:
strTopic = _T("gadget.htm");
break;
case HH_WHATSIT_DIALOG:
strTopic = _T("whatsit.htm");
break;
case HH_WIDGET_DIALOG:
strTopic = _T("widget.htm");
break;
case HH_TECH_SUPPORT:
strTopic = _T("http://www.mycompany.com");
bIsLocal = FALSE;
break;
default:
strTopic = _T("unknown-context.htm");
break;
}
return ShowHelp(strTopic, bIsLocal);
}
...........................................................................................................................................
Using ShowHelpContext makes maintaining context-sensitive Help much easier because if a topic name changes, only one function has to be modified. The context IDs (for example, HH_GADGET_DIALOG) should be declared in a header file that can be shared among the program modules that use context-sensitive WebHelp or WebHelp Pro. This can be the same file where the prototypes for ShowHelp and ShowHelpContext are defined.
note: Microsoft HTML Help projects only.
•To call a topic using a map number, make a call to the HTML Help API using the following syntax:
HWND HtmlHelp(Window(), “c:\path\helpfile.chm”, HH_HELP_CONTEXT, Number);
•To call a topic using a filename, make a call to the HTML Help API using the following syntax:
HWND HtmlHelp (Dialog(), “c:\path\helpfile.chm”, HH_DISPLAY_TOPIC, "topicfile.htm");
The method for programming What’s This? Help depends on the way the context-sensitive Help was created.
•If the Help was created in RoboHelp as text-only topic files, see your software development kit for details.
•If the Help was created in What’s This? Help Composer, see Create What's This? Help.
note: For more information, see the HTML Help API Reference at http://msdn.microsoft.com/en-us/library/ms670068(VS.85).aspx.
•Use WebHelp to display context-sensitive Help topics for C++ and Visual Basic applications, Java applications, and Web pages. For more information, see WebHelp.
•Use JavaHelp to display context-sensitive Help topics for Java applications. For more information, see Create context-sensitive JavaHelp.
•Use Oracle Help to display context-sensitive Help topics for Java applications, or applications written in other programming languages. For more information, see Create context-sensitive Oracle Help.
note: If you must use your HTML Help output as a backup to a WebHelp, WebHelp Pro, FlashHelp, or FlashHelp Pro system that is on a server, use Adobe's airplane Help.
Sample code:
HtmlHelp(hWnd, /*Window handle of program or dialog*/
"CSHHelp.chm", /*Name of the CHM file*/
HH_HELP_CONTEXT,
dwMapNumber); /*Map number from map file*/
HtmlHelp(hWnd
Program or dialog box window handle. A window handle identifies a window so the HTML Help engine discovers what application is performing the action.
CSHHelp.chm
Compiled HTML help file. It includes context-sensitive help. Give the developer this file for use with the application.
HH_HELP_CONTEXT
This is the command sent to the HTML Help engine for window-level Help. (A command such as HH_TP_HELP_WM_HELP is used for What's This? Help.)
Dwmapnumber
Map number from map file
note: Microsoft HTML Help projects only.
Problem |
Wrong Help topic opens. |
Error message |
Command: HH_HELP_CONTEXT Processing C:\Project Folder\HelpProject.chm Map Number: 2750 File: Folder_Name\Topic_Name.htm |
Cause |
Incorrect map ID. |
Resolution |
Update the map ID. Generate the project and retest. |
OR: |
|
Cause |
Wrong or outdated map file. |
Resolution |
Ensure everyone is using the correct map file. If the correct map file is used, unassign the map ID for the topic. Remove the old map file and import the new map file. Assign new map IDs. Generate and retest. |
Problem |
Topic is not displayed. |
Error message |
1. No message 2. Command: HH_HELP_CONTEXT Result: HH_HELP_CONTEXT called without a [Map] section 3. Command: HH_HELP_CONTEXT Processing C:\Folder Name\Project_Name.chm Result: Cannot find 180010 in C:\Folder Name\Project_Name.chm |
Cause |
No assigned map ID. |
Resolution |
If the map file does not exist, the message "HH_HELP_CONTEXT called without a [Map] section" appears. For developer-supplied map files, import the map file. Assign the map IDs. If the message "Cannot find 180010 in C:\Folder Name\Project_Name.chm" displays, update the map ID. Generate and retest. |
Problem |
Topic does not appear or wrong topic appears. |
Error message |
1. Command: HH_HELP_CONTEXT Processing C:\Project Folder\Project_Name.chm Map Number: 1 File: Folder_Name\Topic_Name.htm 2. Command: HH_HELP_CONTEXT Processing C:\Project Folder\Project_Name.chm Result: Cannot find 180010 in C:\Project Folder\Project_Name.chm |
Cause |
Wrong map number used in the call. |
Resolution |
Print the Map IDs report and give it to the developer. Use this file to correct map number assignments. |
Problem |
Topic appears in wrong dialog box. |
Error message |
"HTML Help Author" opens and displays, "The window name 'window' passed to HH_GET_WIN_TYPE has not been specified." |
Cause |
Wrong dialog name used in the call or author did not inform the developer that a custom window was created for the topics. |
Resolution |
Ensure the developer knows about the custom dialog. Generate and retest after the application updates. |
Problem |
Topic is not displayed. |
Error message |
1. Message is not displayed 2. Command: HH_HELP_CONTEXT Result: HH_HELP_CONTEXT called without a [Map] section |
Cause |
Map file or map number is missing. |
Resolution |
For developer-supplied map file, restore or update the map file. Generate the and retest. |
tip: Use the context-sensitive Help API and support files to call built-in functionality, rather than creating functions to display topics.
Context-sensitive JavaHelp requires custom code from your developer.
A printed copy of the .JHM file may help your developer.
public class ContextHelp
{
private HelpSet hs;
private HelpBroker hb;
public boolean ShowHelp(String strTopic, String strHelpSet){
if (hb == null) {
ClassLoader loader = getClass().getClassLoader();
URL url;
try {
url = HelpSet.findHelpSet(loader, strHelpSet);
hs = new HelpSet(loader, url);
}
catch (Exception e) {
return false;
}
hb = hs.createHelpBroker();
}
hb.setCurrentID(strTopic);
hb.setDisplayed(true);
return true;
}
}
Testing context-sensitive JavaHelp involves authors and developers.
Compress The Project
Compile the project and create a .JAR file. Give the .JAR to your developer.
Test Context-Sensitive Topics
Test topics in the application to ensure they appear in the correct dialogs and windows.
Resolve Errors
Work with your developer to solve any problems.
note: This information is for developers who need to connect context-sensitive Oracle Help topics to applications.
tip: The context-sensitive Help API and support files let you call built-in functionality instead of having to create the functions to display topics.
Oracle Help supports context-sensitive Help, but your developer must write and customize the code to make it work.
A working example of a Java application with context-sensitive Help is shown below. To run the example:
1)Ensure that you have the Oracle Help for Java components and the Sun Java 2 SDK or later.
2)Copy and paste the code below into a file called CSHDemo.java.
3)Compile the file (for example, javac CSHDemo.java).
4)Run the Java applet (for example, java .cSHDemo <Oracle Help Helpset file>). The Oracle Help helpset file parameter is the fully-qualified path to the helpset file. As an example, if you create an Oracle Help helpset file named "sample.hs" and saved it in "C:\myFiles," the command to run this application with your helpset file would be:
java CSHDemo C:\myFiles\Sample.hs
/*********************************************************************************
* Oracle Help Context-Sensitive Help Sample Application
*
* This application is intended to demonstrate a few methods for invoking
* context-sensitive Help with Oracle Help.
*
* USAGE: CSHSample <full path to helpset file>
*
*********************************************************************************/
import oracle.help.Help;
import oracle.help.CSHManager;
import oracle.help.library.Book;
import oracle.help.library.helpset.HelpSet;
import oracle.help.navigator.Navigator;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
public class CSHSample extends Frame implements ActionListener
{
private Help helpObj;
private Book bookObj;
private CSHManager contextManager;
private MenuItem exitMenu;
private MenuItem contentsMenu;
private MenuItem searchMenu;
private MenuItem indexMenu;
// Constants set to TopicIDs from map file for Helpset passed in
// via command line.
public static final String LABEL = "what_is_a_label_htm";
public static final String FIELD = "what_is_a_text_field_htm";
public static void main(String[] args)
{
if (args.length != 1) {
System.err.println("Usage: CSHSample <full path to helpset file>");
System.exit(1);
}
Book bookObj = null;
String filename = args[0];
// Expects filename format to be: "file:/[<drive>:/]dir/<helpset_file>"
// e.g., "file:/c:/myPath/myHelp.hs"
if (filename.charAt(0) == '/')
filename = "file:" + filename;
else
filename = "file:/" + filename;
try {
bookObj = (Book) new HelpSet(new URL(filename));
}
catch (Exception e) {
System.err.println("CSHSample Error: " + e.getMessage());
System.exit(1);
}
CSHSample sampApp = new CSHSample(bookObj);
sampApp.setVisible(true);
}
// Class Constructor
public CSHSample(Book bookObj)
{
super("CSH Sample Application");
setResizable(false);
setSize(300, 200);
// Create Help Objects
try {
helpObj = new Help(false, false);
contextManager = new CSHManager(helpObj);
contextManager.addBook(bookObj, true);
}
catch (Exception e) {
System.err.println("CSHSample:: Failed While Creating Help object");
e.printStackTrace();
System.exit(1);
}
/********************************************************************
* Add UI Components
*******************************************************************/
MenuBar menubar = new MenuBar();
Menu filemenu = new Menu("File");
exitMenu = new MenuItem("Exit");
filemenu.add(exitMenu);
exitMenu.addActionListener(this);
menubar.add(filemenu);
Menu helpmenu = new Menu("Help");
contentsMenu = new MenuItem("Help Contents");
contentsMenu.addActionListener(this);
helpmenu.add(contentsMenu);
indexMenu = new MenuItem("Topic Index");
indexMenu.addActionListener(this);
helpmenu.add(indexMenu);
searchMenu = new MenuItem("Full Text Search");
searchMenu.addActionListener(this);
helpmenu.add(searchMenu);
menubar.add(helpmenu);
setMenuBar(menubar);
Panel mainPanel = new Panel();
add(mainPanel, BorderLayout.CENTER);
// Add label
Label label = new Label("Country:", Label.LEFT);
mainPanel.add(label);
// Set context help for component. TopicID = LABEL
// Pass the component with the associated TopicID to the CSHManager Object
contextManager.addComponent(label, LABEL, true, true);
// Add TextField
TextField field = new TextField(15);
mainPanel.add(field);
// Set context help for component. TopicID = FIELD
// Pass the component with the associated TopicID to the CSHManager Object
contextManager.addComponent(field, FIELD, true, true);
/********************************************************************
* End: Add UI Components
*******************************************************************/
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
System.exit(0);
}
}
);
}
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if (source == exitMenu) {
setVisible(false);
System.exit(0);
}
else if (source == contentsMenu) {
// Show Help; Display Contents tab
Navigator[] navs = contextManager.getAllNavigators();
if (navs != null)
contextManager.showNavigatorWindow(navs[0]);
}
else if (source == indexMenu) {
// Show Help; Display Index tab
Navigator[] navs = contextManager.getAllNavigators();
if (navs != null)
contextManager.showNavigatorWindow(navs[1]);
}
else if (source == searchMenu) {
// Show Help; Display Search tab
Navigator[] navs = contextManager.getAllNavigators();
if (navs != null)
contextManager.showNavigatorWindow(navs[2]);
}
}
}
note: Oracle Help uses topic IDs (in a map file) to make context-sensitive Help calls. You can change the topic ID by editing the topic's META tag.