HotDocs.Application Object

The Application object represents the library window in HotDocs and the main functional uses of HotDocs. It is used to customize the user interface of the library window and control the display of the library. It also serves as the root of the HotDocs object model.

The Application class is a singleton class, which means that one and only one instance can exist on a Windows desktop at a time. The class factory for this class enforces this rule. When an application requests an instance of this class, the class factory checks to see if an instance already exists. If so, the requesting application is given a pointer to this existent instance. This means that an integration needs to be aware that other applications or the user may be changing the state of the object. For instance, care must be taken when deleting all the Assembly objects in the assembly queue so that your integration does not remove assemblies started by the user or other applications.

Reference counting of the Application object can be a tricky concept. Because of its shared-singleton nature, an integration cannot assume that the server (hotdocs.exe) will unload when the integration releases all of the references it holds to the COM objects. There are many clients which hold references to the Application object. The most visible of these is the user interface. The library interface is a client of the Application object. When it is visible, it holds a reference to the Application object. When it is hidden, it releases its reference. This means that if your program makes the HotDocs library interface visible, then exits, HotDocs will continue to run because the interface still holds a COM reference. To make sure that things are in an appropriate state when your application is finished with HotDocs, you must make sure the state of the user interface is the same as when you started.

General information

ProgID: HotDocs.Application.11.0
HotDocs.Application (version-independent)
CLSID: {8A202ADA-F14D-4F1B-86F9-8B18EE76E0C1}
The following table shows the name and IID for each interface, as well as the version of HotDocs in which it was introduced. The primary interface and the main public interface exposed by this object is _Application4.
Name IID Added in
_Application {991DE9DD-D19A-4EA0-9A07-D56F0CA44FE9} Added in HotDocs 6.0
_Application2 {991DE9DD-D19A-4EA0-9A07-D56F0CA44FEA} Added in HotDocs 6.1 SP1
_Application3 {991DE9DD-D19A-4EA0-9A07-D56F0CA44FEB} Added in HotDocs 2005
_Application4 {991DE9DD-D19A-4EA0-9A07-D56F0CA44FEC} Added in HotDocs 2005 SP2
_Application5 {5C438478-E1F3-47ac-9012-EB497A45B704} Added in HotDocs 2008
_Application6 {D5CC34E3-13FE-46eb-88BE-B00DC4924505} Added in HotDocs 10
_Application7 {FCE63E5C-BA73-413b-9331-19B8FC556061} Added for HotDocs 10.2
_Application8 {9DA30382-4BA9-44B6-BD51-D8E2D28E2E9D} Added for HotDocs 11.0
_ApplicationEvents {287BF4B6-F8A1-4D96-B9A6-D1F6A56AB86C} Added in HotDocs 6.0

The _ApplicationEvents interface designates an event sink interface that an application must implement in order to receive event notifications from a HotDocs.Application object.

Methods

Method Description
AddUserMenuItem This method allows you to add custom menu items to the HotDocs library menus. For example, you can add an item to the HotDocs Help menu to display your own "About" dialog box. When a user selects the item from the menu, the OnUserMenuItemClickedEvent event is fired to notify your application that the menu item was chosen.
AddUserMenuItem2 This method allows you to add custom menu items to the HotDocs library menus. For example, you can add an item to the HotDocs Help menu to display your own "About" dialog box. When a user selects the item from the menu, the OnUserMenuItemClickedEvent event is fired to notify your application that the menu item was chosen.
ConvertModelToTemplate This method converts a HotDocs Model to a HotDocs template.
ConvertTemplateToModel This method converts a HotDocs template to a HotDocs Model.
CreateTemplatePackage This method creates a template package for use with HotDocs Cloud Services or the HotDocs Open SDK.
DeleteUserMenuItem This method allows you to remove custom items that were added to the HotDocs library window menus using AddUserMenuItem or AddUserMenuItem2. It uses the handle returned when the menu item was added to determine which menu item to remove.
getDefaultPath This method returns the default path HotDocs uses for the specified file type. You can use this method to determine the default path for any type of file in the HDDirectory enumeration.
GetHotDocsSetting This method returns a HotDocs setting from the system registry. HotDocs looks first in the HKEY_CURRENT_USER registry hive, followed by the HKEY_LOCAL_MACHINE hive. If the setting is not found in either hive, the defaultValue is returned.
OpenLibrary This method opens a HotDocs library (.HDL) file. If another library is already open, OpenLibrary closes the other library and opens the library specified in the libPath parameter.
PrintDocument This method prints the specified document.
PublishOnlineFiles This method publishes a template for use with HotDocs Server. Like the Publishing Wizard (available in the HotDocs Tools menu), this method scans the template for any inserted templates and builds the JavaScript (.JS) and HotDocs Variable Collection (.HVC) files required for HotDocs Server. These .JS and .HVC files are then copied to an output folder along with the template files.
PublishOnlineFiles2

Use this method to publish a template for use with HotDocs Server.

ResolveReferencePath This method converts a reference path to a full file system path. For example, if you use SelectTemplate2 to get the path of a selected template that includes a reference path (e.g., ^PUBTest\template.rtf), this method can look up the reference path keyword and return a full path (e.g., C:\HotDocs\Templates\template.rtf).
RetrieveUrlFile This method retrieves a file from the specified URL.
SaveDocAsPDF This method converts a document file to a PDF file using HotDocs PDF Advantage. The conversion is done automatically, so no user intervention is necessary, although some user interface may be displayed.
SelectMultipleTemplates This method opens the specified library in a modal dialog box, allowing users to select multiple templates by pressing Shift or Ctrl as they click templates. The selected templates are then passed back to the integrating program in a SAFEARRAY structure.
SelectMultipleTemplates2 This method opens the specified library in a modal dialog box, allowing users to select multiple templates by pressing Shift or Ctrl as they click templates. The selected templates are then passed back to the integrating program in a SAFEARRAY structure.
SelectTemplate This method opens a modal dialog that displays the specified library, allowing the user to select a template. The path, title, and description of the selected template are then passed back to the integrating program.
SelectTemplate2 This method opens the specified library in a modal dialog box, allowing users to select a single template. The path, title, and description of the selected template are then passed back to the integrating program.
SendToWordProcessor This method sends a document specified in the docFileName parameter to the word processor.
SetUserInterfaceItem This method sets the state for various features (elements) of the HotDocs library window. For example, you can use this method to disable features your integration users should not have access to, or you can enable features users may have disabled.

Properties

Property Description
ActiveAssembly [Read-only] This property returns an Assembly object representing the template currently being assembled.
Assemblies [Read-only] This property returns an AssemblyCollection object, which is the collection of Assembly objects in the HotDocs assembly queue. By querying the Assemblies property, you can get all of the Assembly objects that are queued for assembly.
AssemblyQueueVisible [Read/Write] This Boolean property controls the visibility status of the HotDocs assembly queue. For example, if the AssemblyQueueVisible property is False, the assembly queue is not visible.
CanAssembleAll [Read-only] This property indicates whether or not the version of HotDocs in use is capable of assembling unregistered templates. Specifically, this property returns true if the version of HotDocs is anything other than Player.
CanEditTemplates [Read-only] This property indicates whether or not the version of HotDocs in use is capable of editing templates. Specifically, this property returns true if the version of HotDocs is Developer or Developer LE.
CommandLine [Write-only] This property sets the HotDocs command line options as if it were started with a particular command line. Setting this property to a string is the same as if the string were passed to the executable when the program was started. For example, if the command line invokes an assembly, a new Assembly object is added to the queue. If the command line changes the appearance or behavior of HotDocs, the change happens immediately.
CurrentLibraryPath [Read-only] This property returns the file system path and file name of the current (open) HotDocs library as a String value
Flavor [Read-only] This property returns a value corresponding to which HotDocs edition (Player, User, Developer, or Developer LE) is being used.
Hwnd [Read-only] This property returns the window handle of the HotDocs library window.
Plugins [Read-only] This property returns a PluginsClass object, which represents a collection of plug-ins currently registered with HotDocs.

Version

[Read-only] This property returns the HotDocs product version number as a String value. For example, if you have HotDocs 11 installed, this property returns 11.
Visible [Read/Write] This Boolean property controls the visibility status of the HotDocs library window. For example, if the Visible property is False, the library window is not visible.

Events

Event Description
AssemblyCompleteEvent This event is fired when assembly completes.
OnAssemblyCompleteEvent

This event has been deprecated for HotDocs Desktop 11. AssemblyCompleteEvent is recommended for use instead.

This event is fired when an assembly is completed. It returns the name and path of the template that was used to assemble the document, the path to the assembled document, a pointer to the AnswerCollection object used in the assembly, and the assembly handle which was given when the assembly was added to the queue.
OnAssemblyStartEvent This event is fired when an assembly starts. It returns a reference to the Assembly object that represents the assembly session.
OnErrorEvent This event is fired when an error occurs. By returning true for the override parameter, the integration can tell HotDocs not to display any user interface indicating that an error occurred, which allows the integration to either display its own error message or silently handle the error.
OnLibraryInterfaceCloseEvent This event is fired when the user closes the HotDocs library user interface.
OnLibraryOpenEvent This event is fired when a library is opened.
OnTemplateSelectedEvent This event is fired when the user selects a template in the library to assemble, or selects a template at the SelectTemplate or SelectMultipleTemplate dialogs. By returning *override == true, the integration can cancel the selection of the template.
OnUserInterfaceEvent This event is fired when the user selects items in the library user interface.
OnUserMenuItemClickedEvent This event is fired when the user selects an integration-defined menu item.