Click here to Skip to main content
Click here to Skip to main content

Simple RTF based Help Dialog

, 3 Oct 2001
Rate this:
Please Sign up or sign in to vote.
Yet Another Simple Help Dialog
<!-- Download Links --> <!-- Article image -->

Sample Image - MyHelpDialog.jpg

<!-- Main HTML starts here -->

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:

  1. Add the HelpDialog.cpp and HelpDialog.h files to your project
  2. 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
  3. 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 Wink | ;-)

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"
//
// Example using the class from RTF resource
//
CSimpleHelpDemoDlg::OnHelpButton()
{
	CHelpDialog hlp(this, IDR_HELP); 	// create Help Dialog using RTF resource
	hlp.SetTitle( "Simple Help Demo" ); 	// set a title (optional)
	hlp.DoModal(); 			// pop it up
}

The next code show how to load the help message from a file on disk:

#include "HelpDialog.h"
//
// Example loading RTF from disk
//
CSimpleHelpDemoDlg::OnHelpButton()
{
	CHelpDialog hlp(this); 		// create Help Dialog
	hlp.SetTitle( "Simple Help Demo" ); 	// set a title (optional)
	hlp.LoadRTFFile( "Help2.rtf" );	// load the RTF from file
	hlp.DoModal(); 			// pop it up
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Antoine Megens
Web Developer
Netherlands Netherlands
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, started MFC about 3 years ago.
 
I'm currently employed by a small engineering firm in the Netherlands, where I live.

Comments and Discussions

 
QuestionHow to Load Image?? Pinmemberxdchen2620-Feb-14 19:11 
AnswerRe: How to Load Image?? PinmemberAntoine Megens20-Feb-14 22:07 
QuestionCallback routine incorrect for unicode [modified] PinmemberMember 949563210-Oct-13 13:29 
Questionhow to go set and use a bookmark ?? Pinmemberxiaocong00421-Feb-12 18:15 
I want to set a bookmark link in my program ,and if I click it the rtf file will go to the page .How can I do that ?thanks.
AnswerRe: how to go set and use a bookmark ?? PinmemberAntoine Megens22-Feb-12 0:24 
GeneralRe: how to go set and use a bookmark ?? Pinmemberxiaocong00422-Feb-12 1:44 
QuestionRTF Image support [modified] Pinmemberbethgocs18-Jun-06 1:12 
AnswerRe: RTF Image support [modified] PinmemberAntoine Megens18-Jun-06 21:31 
GeneralWindow is not Updated Pinmemberazghar6-Oct-03 2:18 
GeneralRe: Window is not Updated PinmemberAntoine Megens6-Oct-03 3:04 
GeneralRe: Window is not Updated PinmemberAzghar6-Oct-03 4:21 
GeneralRe: Window is not Updated PinmemberAntoine Megens6-Oct-03 4:52 
General[Message Removed] Pinmemberimmetoz4-Oct-08 15:12 
Questionwindow too big? PinmemberAntoine Megens12-Jun-02 23:15 
Generala bug Pinmemberdragonred10-Sep-01 15:30 
GeneralRe: a bug PinmemberAntoine Megens3-Oct-01 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140718.1 | Last Updated 4 Oct 2001
Article Copyright 2001 by Antoine Megens
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid