Creating Help for LabWindows™/CVI Libraries

Updated Jun 1, 2023

Environment

Software

  • LabWindows/CVI

To help your users understand how to program with user-defined functions, include documentation in files you distribute. You can include documentation in source files and in function panels that you create for end users. This document describes how to add documentation and how to generate HTML help.

Including Help in Source Files

To include help in source files for user-defined functions, you must use special tags. Complete the following steps to add the tags:

  1. Position your cursor on the line before the function definition.
  2. Select Edit»Insert Construct»Function Documentation Tags. LabWindows™/CVI inserts tags for function help (/// HIFN), the return value (/// HIRET), and for each parameter (///HIPAR parameterName).
  3. Fill in help for each tag. An example follows.
 /// HIFN Adds two numbers and returns the result.
/// HIRET The result of the addition.
/// HIPAR A/First number to add.
/// HIPAR B/Second number to add.
int Add (int A, int B) {
    int addResult;
    addResult = A + B;
   return addResult;
}
  1. Compile the file.

When your user calls the function, LabWindows™/CVI displays the help as tooltips. Note that you must enable source code browsing to display tooltips.

For more information about these tags, refer to Documentation Tags for Source Code.

Including Help in Function Panels

Adding Plain Text Help to Function Panels

To include plain text help, type the documentation directly in the function panel Help Editor.
 

Adding HTML Help to Function Panels

Use HTML tags in function panel help to have more control over the display of your content. You also can include images with the HTML <img> tag. To add HTML help, use HTML tags in the function panel, as shown in the following figure:



Note that you can include a link to your own Cascading Style Sheets (CSS). Move the CSS to the same directory as your .fp file and use %FP_PATH% in the HTML link element, as shown in the following example:

<link rel="stylesheet" href="%FP_PATH%/stylesheet.css" type="text/css">


You also can define styles directly in the HTML, as shown in the following example:

To include images in your help, copy the images into the following directory: <cvidir>\bin\libref. Because this directory includes images for LabWindows™/CVI Help, ensure that you do not overwrite any existing images.
 

Generating Function Trees from an Include File

You can generate function trees from include files using specially defined tags. For more information about these tags, refer to the help for the Generate Function Tree menu option.

If you generate a .fp file from a header file, you can add HTML or text help and specify an HTML file using these tags. The following example shows the different ways you can specify help:

/* Plain text */
/// HIFN Adds two numbers and returns the result.
/// HIPAR 1/First number to add.
/// HIPAR 2/Second number to add.
/// HIRET The result of the addition.
int CVIFUNC Add (int A, int B);

/* HTML in tags */
/// HIFN <html><body><p>Subtracts two numbers and returns the result.</p></body></html>
/// HIPAR 1/<html><body><p>Number from which to subtract B.</p></body></html>
/// HIPAR 2/<html><body><p>Number to subtract from A.</p></body></html>
/// HIRET <html><body><p>The result of the subtraction.</p></body></html>
int CVIFUNC Subtract (int A, int B);

/* External HTML files */
/// HFUN MultiplyFunctionHelp.html
/// HPAR 1/MultiplyParamAHelp.html, 2/MultiplyParamBHelp.html
/// HRET MultiplyReturnHelp.html
int CVIFUNC Multiply (int A, int B);


To generate the .fp file, select Options»Generate Function Tree.
 

Generating HTML Help

You can generate HTML files that include either plain text help content or HTML help content from your function panel and source file documentation.
 

Generating HTML Help from Source Files

To generate HTML help from source files, complete the following steps:

  1. Select Build»Target Settings.
  2. Select HTML from the Generate help from source option in the Target Settings dialog box.
  3. Click the OK button and build your project.
 

Generating HTML Help from Function Panels

To generate HTML help from function panels, select Options»Generate Documentation»HTML in the Function Tree Editor. The HTML generated using this method overwrites any styles you previously specified using a style sheet or using style tags in the HTML when you initially added HTML help content.
 

Using the HTML Files to Create CHM Files

LabWindows™/CVI generates the following HTML files:
  • Overview topic
  • One topic per function
  • Topic showing the function hierarchy
  • Topic with an alphabetical function list
  • HTML help project file (.hhp)

LabWindows™/CVI places files generated from source files within a folder named cvicomments.projectname\Debug or cvicomments.projectname\Release, depending on the configuration of your project.

For files generated from .fp files, LabWindows™/CVI places the overview and .hhp file in the same folder as the .fp file and places the other files in a folder named InstrumentDriverFilename_files.

You can use the .hhp file to create Microsoft compiled HTML help (.chm) using Microsoft HTML Help Workshop, which you can download from the Microsoft website if you do not already have it installed. You can compile the .hhp file that LabWindows™/CVI generates without modifications, and Microsoft HTML Help Workshop outputs a .chm file. However, consider creating a table of contents and index file to help your end users with navigation.

The following image shows a .chm file created with a .hhp file generated from LabWindows™/CVI: