Introduction
This Rich Text based Help Dialog is a quick and easy way of adding on-line help to your
applications. For some applications its just too much work to build a complete
help system, but its sufficient to display some guide lines. This dialog has the
"looks and feel" of the real thing.
Features
- Standard Help Window look and feel
- Auto size of window to fit RTF text
- Resizable
- Auto scrollbars in case window is resized too small to fit complete RTF
text
- Copy and Print via context menu
- Can load RTF from resource OR from file on disk
How to add this class to your project
The steps to include this dialog into your project are:
- Add the HelpDialog.cpp
and HelpDialog.h
files to your project
- Copy and Paste the following Help Dialog resources from the demo project
resources into your project:
- IDR_POPUP_HELP_MENU menu
- IDD_HELP_DIALOG dialog
- IDI_HELP_ICON icon
- Add a Help button or menu to your project (see sample project)
The Rich Text Format (RTF) contents of the help message can best be created
using Wordpad. I have tried Word as well, but the resulting RTF format is
sometimes too elaborate to be used in the Rich Edit control. You can tell if your RTF it too elaborate, because if that is the case the Help Dialog
will not show any message at all ;-)
The RTF can be
loaded in two different methods, the first is to import the RTF file into the
resources of your project. The 2nd method is to load the RTF file from disk at
runtime. Select the method that fits your needs best. The demo project shows
both methods.
#include "HelpDialog.h"
CSimpleHelpDemoDlg::OnHelpButton()
{
CHelpDialog hlp(this, IDR_HELP);
hlp.SetTitle( "Simple Help Demo" );
hlp.DoModal();
}
The next code show how to load the help message from a file on disk:
#include "HelpDialog.h"
CSimpleHelpDemoDlg::OnHelpButton()
{
CHelpDialog hlp(this);
hlp.SetTitle( "Simple Help Demo" );
hlp.LoadRTFFile( "Help2.rtf" );
hlp.DoModal();
}
The demo project also shows (see both Help menu items) how to use the dialog
in modeless mode. Although a little bit more work is required, this is the preferred
method. With a modeless help dialog, the user can switch to the application and
refer to the help dialog at the same time. With the modal approach, as in the
samples above, the help dialog must be closed first before the application
window can be accessed.
Final notes
This article was inspired by the TCX Message Box By Thales P. Carvalho
and in fact I used his dialog class at first for my help messages. Later I felt
the need to make it look more like a real help message, hence this class. And
yes, I know there's the real help system out there, but the steps involved in
building a real help file (RTF file, Help ID's, Help Compiler, etc.) are
sometimes simply too much work.
History
4 Oct 2001 - fix for the detected streamin bug.
I've been in touch with computers since 1979 when I bought my OSI Superboard. Self taught men ever since, learned C programming on a VAX, learned MFC for a nice Space related project.
Later came into contact with C#/.NET and reached MCAD level in 2007 (now expired).
I'm currently employed by a small engineering firm in the Netherlands, where I live.