Creating CHM with search and index

    I think many of you have encountered such a problem. You go to the site - you see a bunch of useful information, but at the same time the site does not have a full-fledged search, there is no index, and using Google every time is, to put it mildly, annoying.
    And plus to everything, I would like to be able to have information under another, even when there is no Internet.

    The CHM format is known to almost everyone. Lightweight, comfortable and functional. It works, however, officially it is only in Windows. This format has a very big plus - after creating such a file in the future it will be possible to edit it.

    What do we need to create a complete (with search, index, content) chm file?
    0. Downloaded copy of the site (we will not consider here - you can get a copy of the site in many ways, for example, using programs such as Teleport Pro, WebCopier)
    1. htm2chm - allows you to conveniently create content and index files (there is a compiler, but without searching)
    2. Microsoft HTML Help WorkShop - the compiler itself, with which we will create chm-ki.

    After installing htm2chm we do integration with the shell.



    Next, using the contextual menu, we create index files (TOC.hhc) and content (Index.hhk).



    Using the htm2chm content editor, we can create a convenient tree structure for presenting information.



    Now we just have to create a project file and compile the project in HTML Help WorkShop.

    Empirically, I created several templates for projects.
    1. Template with content and favorites, without pointer (encoding - Win1251):

    [OPTIONS]
    Compatibility = 1.1 or later
    Compiled file = Project.chm
    Contents file = TOC.hhc
    Default Window = ProjectType
    Default topic = Index.htm
    Display compile progress = No
    Full-text search = Yes
    Language = 0x419 Russian

    [WINDOWS]
    ProjectType = "???", "TOC.hhc" ,, "Index.htm", "Index.htm" ,,,,, 0x63520,, 0x184e ,, ,,,,,, 0

    [FILES]
    Sample.hhp

    [INFOTYPES]

    here:
    Project.chm is the name of the output file.
    Index.htm - start / home page for the help file

    All the necessary files for compilation are picked up from the contents file (TOC.hhc).

    2. Template with content and pointer, as well as a font change button:
    [OPTIONS]
    Compatibility = 1.1 or later
    Compiled file = Project.chm
    Default Window = WindowType
    Default topic = Index.htm
    Display compile progress = No
    Full-text search = Yes
    Language = 0x419 Russian

    [WINDOWS]
    WindowType = "???", "TOC.hhc", "Index.hhk", "Index.htm", "Index.htm" ,,,,, 0x60520,250,0x10184e, [ 10,10,700,500] ,, 0x200,1 ,,,, 0

    [FILES]
    Sample_FIT.hhp

    [INFOTYPES]

    3. Template with content and pointer, as well as a button for changing the font and add. button (“About”):
    [OPTIONS]
    Compatibility = 1.1 or later
    Compiled file = Project.chm
    Default Window = WindowType
    Default topic = Index.htm
    Display compile progress = No
    Full-text search = Yes
    Language = 0x419 Russian

    [WINDOWS]
    WindowType = "???", "TOC.hhc", "Index.hhk", "Index.htm", "Index.htm" ,,, "About.htm", "About", 0x60520,250,0x18184e, [ 10,10,700,500] ,, 0x200,1 ,,,, 0

    [FILES]
    Sample_FITJ2.hhp

    [INFOTYPES]

    here:
    About - the name of the button
    About.htm - the file that the button refers to

    If you carefully look at the TOC.hhc file, you will notice that this is a regular xml file that lists the parameters, as well as display settings for the help file.
    We’ll talk about these settings.
    You can see something like these lines:
    PARAM name = "Window Styles" value = "0x800627"
    PARAM name = "ImageType" value = "Folder"
    PARAM name = "ExWindow Styles" value = "0x2200"

    The value for Window Styles is hex format. Here is the decryption:
    PARAM name = "Window Styles" value = "0xb0daec"
    where:
    c:
    bit 1 - Plus / Minus squares | Plus / minus squares
    bit 2 - Draw lines between items | Draw lines between elements of
    bit 4 - Start line from the root | Start line from root element
    e:
    bit 2 - Show selection when focus lost | Show selection when focus is lost
    Better to set - otherwise, with the Hide / Show combination, the current topic will not be displayed.
    a:
    bit 4 - Only expand a single heading | Expand only a single header
    i.e. Automatically expand headings with sections when selected.
    bit 2 - Automatically track selection | Automatically underline element
    bit 1 - Put checkboxes (but why?) ...
    d:
    bit 1 - Select entire row | Highlighting a full line (useful thing)
    only if the Draw lines between items
    b style is not selected :
    bit 8 - Border | Frame (only meaningful for Dialog Frame)
    bit 4 - Dialog Frame | Dialog box

    Total for 0x800627 we have:
    8 - (Border)
    6 - 4 + 2 (Only expand a single heading, Automatically track selection)
    2 - (Show selection when focus lost)
    7 - 4 + 2 + 1 (Plus / Minus squares, Draw lines between items, Start line from the root)

    Optional:
    Right-to-left reading order | Reading order from right to left
    (pure bit)
    param name = "ExWindow Styles" value = "0x2200"
    Raised edge | Embossed edge (no difference is visible with it)
    (pure bit)
    param name = "ExWindow Styles" value = "0x100"
    Scroll bar on left side | Scroll bar on the left side
    (pure bit)
    param name = "ExWindow Styles" value = "0x4200"

    PARAM name = "ImageType" value = "Folder"
    If this parameter is specified, the icons are displayed as files.

    This is the end of the description. For compilation we use:
    "% PROGRAMFILES% \ HTML Help Workshop \ hhc.exe" <PROJECT NAME.HHP>

    At the end we will see a report like this:
    Compiling .. \ bacula_24 \ Bacula_24.chm

    Compile time: 0 minutes, 3 seconds
    70 Topics
    5,168 Local links
    74 Internet links
    34 Graphics

    PS. Many tools can be used for decompilation, personally I use the FAR manager lotion - CHMView.

    Also popular now: