Adding NetHelp2 to Your Application
After your NetHelp2 system is completed, you'll need to connect it
to your application. The following document describes this process and
the sample code provided in the SDK. The intended audience is application
developers.
Summary
NetHelp systems for native applications or HTML-based applications differ
only in how they are invoked. The same help system can be accessed from either a
native application or an HTML-based application.
In both access methods, a topic ID is passed to Navigator. For native
applications, the ID is passed to Navigator using OS-specific interprocess
communication (IPC) methods. For HTML-based applications, the ID
is passed to Navigator using a special nethelp URL.
Linking to a NetHelp System
The following sections describe how applications can be linked to NetHelp
systems. Included with this SDK is the actual code (C/C++) used in some
of our products that you can use (some modifications may be necessary)
to call NetHelp from your product. Each operating system's sample code
is accompanied by explanatory notes. Additionally, this document describes
the HTML or JavaScript syntax used to access NetHelp from HTML.
Windows
Windows applications launch NetHelp via OLE (Object Linking and Embedding)
automation. NetHelp's API (Application Program Interface) on Windows is
a subset of Netscape Navigator's OLE automation support. For general information
on Navigator and OLE automation, see the DevEdge article OLE
Automation in Navigator.
View the sample code and accompanying readme files for additional information.
Caveat |
If you are using the Microsoft programming tools, you must state your use
of OLE. Put this line of code into their files called "stdafx.h":
#include <afxdisp.h> // MFC OLE automation classes |
Macintosh
Macintosh applications launch NetHelp via AppleEvents. NetHelp's API on
Windows is a subset of Netscape Navigator's AppleEvent support. For general
information on Navigator and OLE automation, see the article
Netscape
API for the Macintosh.
View the sample code and accompanying readme files for additional information.
UNIX
UNIX applications launch NetHelp via X properties. NetHelp's API on UNIX
is a subset of Netscape Navigator's UNIX API support. For general information
on controlling Navigator on UNIX systems, see the article
Remote
Control of UNIX Netscape.
View the sample code and accompanying readme files for additional information.
HTML
Accessing NetHelp from HTML is as simple as coding a link. Netscape Navigator
understands a new URL (Uniform Resource Locator) syntax: the nethelp URL.
This URL passes the topic ID to Navigator, causing a NetHelp window to
be opened, and the topic to be displayed. To attach NetHelp to an HTML-based
application, simply code HTML links.
For example, this text link,
or this image link
,
in a page viewed by Communicator, passes the topic ID "start_here" to Navigator,
causing the first topic in the Communicator online help system to be displayed.
These links have the following HTML coding:
<A HREF="nethelp:netscape/home:start_here">this text link</A>
<A HREF="nethelp:netscape/home:start_here"><IMG SRC="commicon.gif"
BORDER=1 HEIGHT=20 WIDTH=20></A>
So, you could code a link like this to point to your own help content:
<A HREF="nethelp:MyCompany/MyCoolProduct:Help_Topic_1</A>
You can call NetHelp from an HTML form button:
This button has the following HTML coding:
<form>
<input type="button" name="Help" value="Help" onClick="javascript:document.location.replace('nethelp:netscape/home:start_here')">
</form>
Java
These instructions are for Java applets running within the Navigator VM
(Virtual Machine):
Bind the following JS to your button onclick with LiveConnect:
javascript:document.location.replace('nethelp_URL')
where nethelp_URL is the nethelp URL for the topic to be loaded.
Any alternative way to load a URL is also acceptable, however, this
method keeps the NetHelp topic out of the regular browser's History stack.
For more information on LiveConnect, see the DevEdge
LiveConnect
documentation.
For more information on the replace method, see the
DevEdge JavaScript
documentation.
Testing Application-to-NetHelp Links
The crucial factor in HTML links to NetHelp is correct syntax for the NetHelp
URL. To see if an NetHelp URL is properly formed, simply type the URL in
the Location field of Navigator and press enter. The NetHelp window should
appear, loading the topic specified by the topic ID in the nethelp URL.
If the NetHelp window does not appear, or the requested topic does not
load, your help.hpf file may be incorrect, the files may not be present,
or the syntax of the nethelp URL might be incorrect. See the Troubleshooting
section for more details on testing access to NetHelp.
Testing Application-to-NetHelp Links for OLE
Two Windows utilities are included with this SDK:
HELPDEMO.EXE,
and NAVHELP.EXE.
How to use HELPDEMO.EXE
HELPDEMO.EXE demonstrates how a native application accesses Netscape Help.
HELPDEMO.EXE is a native Windows application with a Help menu. In fact,
this is simply the Help menu portion of an existing Netscape application.
Help topics in the sample help system can be accessed from HELPDEMO.EXE's
Help menu in the same way they would be from any other native application.
How to use NAVHELP.EXE
Included with this SDK is a Windows application called NAVHELP.EXE. This
is a utility that allows you to test context-sensitive help files even
when the application that will ultimately call your help is not available.
By specifying a help ID, you can "test-drive" what will happen when a help
button is clicked in your application, or F1 is pressed. This utility is
only available under Windows for this release but will be available for
Mac and Unix platforms in the future.
-
Copy NAVHELP.EXE to the local directory containing your help source files.
-
From Windows File Manager (NT) or Explorer (Win95), double-click NAVHELP.EXE.
-
Choose Options>Help File to specify the help project file (.h) for the
help you want to test.
-
Type the help ID that you want to test in the Help ID string field.
Note: The Help Search String feature is not enabled for this
release.
-
Click the Show Help Page button.
The browser opens displaying the page referenced by the help ID you
specified.
Repeat steps 4 and 5 for each help ID you want to test.