|
If you have a Microsoft Windows program or product to
distribute that requires a help file, you may have tried
to use Microsoft HTML Help. The help compiler is free, and
it produces the .CHM file that the HTML Help file viewer
uses. You would have also discovered that it is difficult to use. If your program or product requires a full
featured help system, with indexing and search
capabilities, then this is what you should use. But what
if you don't need any of the advanced search and indexing
features of HTML Help? What if you only need a simple
HTML-based help system that mainly uses hyperlinks and
file selection? For most applications, HTML Help is
overkill. This page
will show you how to create a custom help system using an
EzWeb Compiler file. We will show you 3 different ways to
implement it: Using EzView; Using Internet Explorer;
and using an embedded web browser control in your
application. Each method can display any webpage
specified by your application code. The
first step is to create your help file content.
These are the webpages that make up your help
system. If you plan to use EzView, then you won't
need a navigation system between pages because EzView has
the treeview to select pages. If using the other two
methods, you will need links to get from page to
page. Usually, you would create a Table of Contents
page as a starting point, from which the user can navigate
to other pages. After
you have created your content, build your EzWeb Compiler file as
usual, by dragging/dropping your files onto EzWeb Compiler.
Method
1: Using EzView To
call any webpage within your EzWeb Compiler file from within your
application, use either WinExec or CreateProcess, and
passing the name of the file you want to load.
You must build a path to where EzView is installed
(possibly in your application folder, or in
"Windows\system32\viewers". For example:
WinExec(
"c:\windows\system32\viewers\ezview.exe c:/myfolder/myhelpfile.ezs/page1.htm", SW_SHOWNORMAL );
Notice the
EzWeb Compiler file path contains the internal HTML filename that
we want to load (page1.htm).
Method
2: Using Internet Explorer This
method is probably the best because it doesn't require
EzView to be shipped with your application, and doesn't
require any extra programming to make your own Help
window. Using the code below, a new Internet
Explorer window will be opened, displaying the specified
webpage within your EzWeb Compiler file. The code also hides
the Toolbar, MenuBar and StatusBar. Notice the URL
specifies the EzWeb Compiler protocol.
IWebBrowser2Ptr ix( L"InternetExplorer.Application" );
ix->put_MenuBar( FALSE );
ix->put_ToolBar( FALSE );
ix->put_StatusBar( FALSE );
CString strPath;
strPath = "ezstor://c:/myfolder/myhelpfile.ezs/helppage1.htm";
_bstr_t bstrUrl = strPath;
ix->put_Visible( VARIANT_TRUE );
ix->Navigate2( &_variant_t(bstrUrl), &vtMissing, &vtMissing, &vtMissing, &vtMissing );
Method
3: Custom Help Window This
method can be very appropriate for some
applications. You would need to create your own Help
window that contains an embedded web browser control (or a
WOW control). Once you have coded this, you just add
code to open the appropriate help page. If your web
browser variable name is m_webctl, then you would do
something like this:
m_webctl.Navigate(
"ezstor://c:/myfolder/myhelpfile.ezs/helppage1.htm"
);
|