Click here to Skip to main content
13,139,132 members (92,311 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 30 Jun 2006

Make your MS-HTML-help-contents perfect

, 30 Jun 2006
Rate this:
Please Sign up or sign in to vote.
Make your MS-HTML-help-contents perfect

Make your MS-HTML-help-contents perfect

Download first tool 
Download second tool


HTML help content is a chm file compiled by Microsoft "HTML help workshop" from a set of html files.
This article shows you how to improve your C/C++ code and html files easily to ensure that chm files compiled work perfectly.

Following is available for C/C++ programs, I guess it is OK for VB and other languages also - but I never use MS help contents for them, please make decision by yourself.
What does "perfect" mean?
We often meet 2 problems when use chm file inside our program:

  1. Missed links from program
    For example, when user clicks a help button on dialog, menu or other places to display help for the issue, but a missed page shows "The page can not be displayed ..."
  2. Missed links inside chm file, which mainly are:
    • Navigation errors
      Click a link on a page to navigate to another page but hyperlink is broken.
    • Image errors
      Images can not be displayed, because of <img> link errors.
    • All other link errors
      Such as wrong references to css and js files.
"Perfect" means that you will not worry again about missed links from today if you read the article carefully and do the same thing as I do - it is very easy!

Simple to get the best

  1. Avoid missed links from C/C++ programs
    Let's have a look for MS help function to display a page:  

    What do we need to do?

    Next time, we call the function in another way: a single path string inside a brace, for example:

    We can also use sub-directory, for example:

    To make sure the call successfully, we just need to use #define directive to define YOUR_DISP (see bellow).
    Calls inside C/C++ a program should be in the same format depended on structures of html files.
    Following is example of my #define:
    #define DISP_HELP(a) HelpHtm::DisplayPage(m_hWnd,a)

    HelpHtm::DisplayPage() is a static class function, which looks like:
    void HelpHtm::DisplayPage(HWND hWnd,CString csHtm)
    //get absolute path to your chm file - maybe with some directory, such as
    CString cs="C:\\myprogram\\PaperLabelMaker.chm::\\htm\\";

    Calling the #define directive in MFC code as:

    (Note: m_hWnd is MFC Windows handle).

    Anyway, I am sure you can manage #define directive call successfully.

    Why use it in this way?
    Here is first tool, you can download it now.
    The tool goes through your C/C++ code and finds all path strings inside the #define directive's braces then checks if they are valid in html files - that is all story.
    I developed the tool in 3 hours and get big benefits in my whole programming life.
    Please note, the tool is for private use, interface is ugly, no help content for it, but it works excellent.
    Following is its interface:

    • [Program directory] is your C/C++ project directory
    • [Help file directory] contains your help html files.
    • [Function word] is #define directive used in C/C++ code, mine is DISP_HELP
    • Left list box displays all links found inside #define directive's braces of C/C++ program.
      If a link starts with 0, it means it is a missed link, you have to find the link from C/C++ code to correct it except you don't care.
      If a link starts with 1, it means OK.
    • Right list box displays all html files.
      Prefix 1 means the file is used by C/C++ code, 0 means not.

    My html files are:

    Please note:
    Do not use forward slash in C/C++ call, such as YOUR_DISP("path\\path0\\file0.htm"), the tool ignores this kind calls.
    Please only use backward slash, such as YOUR_DISP("path/path0/file0.htm").

    As I said before, the tool is for private use and very easy to be developed, important thing is its idea.
    If you do not like its #define directive or interface, you can code yourself - please submit it here so we can share our works.

  2. Avoid Missed links inside chm file

    The best way to avoid this kind errors is to check missed links directly in html files before compiled them as a chm file, so we can modify errors from html pages.
    To check missed links of this kind, you need to download second tool.
    The tool has help content to show you how to use it in details, I do not repeat again here.


From first day I had the two tools, all of my MS help contents work perfect without any missed link.
I hope you get same benefits and release all headaches about html help contents for forever.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Australia Australia

Please visit our Download Home to obtain many interesting software for free ...

You may also be interested in...


Comments and Discussions

QuestionHave you ever used HTMLHELP inside a CFormView? Pin
Member 345539813-Nov-08 9:20
memberMember 345539813-Nov-08 9:20 
AnswerRe: Have you ever used HTMLHELP inside a CFormView? Pin
Graham Shanks15-Dec-08 10:48
memberGraham Shanks15-Dec-08 10:48 
GeneralRe: Have you ever used HTMLHELP inside a CFormView? Pin
Member 345539816-Dec-08 3:51
memberMember 345539816-Dec-08 3:51 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170915.1 | Last Updated 30 Jun 2006
Article Copyright 2006 by includeh10
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid