Application API of StyleVision
The COM-based API of StyleVision (also called the Application API from now on) enables other applications to use the functionality of StyleVision.
StyleVision and its Application API follow the common specifications for automation servers set out by Microsoft. It is possible to access the methods and properties of the Application API from common development environments, such as those using C#, C++, VisualBasic, and Delphi, and with scripting languages like JScript and VBScript.
Execution environments for the Application API
The Application API can be accessed from the following execution environments:
•External programs (described below and in the Overview part of this section)
•From within the built-in Scripting Editor of StyleVision. For a description of the scripting environment, see the section, Scripting Editor.
•Via an ActiveX Control, which is available if the integration package is installed. For more information, see the section ActiveX Integration.
In the Overview part of this section, we describe how the functionality of StyleVision can be accessed and automated from external programs.
Using the Application API from outside StyleVision requires an instance of StyleVision to be started first. How this is done depends on the programming language used. See the section, Programming Languages, for information about individual languages.
Essentially, StyleVision will be started via its COM registration. Then the Application object associated with the StyleVision instance is returned. Depending on the COM settings, an object associated with an already running StyleVision can be returned. Any programming language that supports creation and invocation of COM objects can be used. The most common of these are listed below.
•JScript script files have a simple syntax and are designed to access COM objects. They can be run directly from a DOS command line or with a double click on Windows Explorer. They are best used for simple automation tasks.
•C# is a full-fledged programming language that has a wide range of existing functionality. Access to COM objects can be automatically wrapped using C#..
•C++ provides direct control over COM access but requires relatively larger amounts of code than the other languages.
•Java: Altova products come with native Java classes that wrap the Application API and provide a full Java look-and-feel.
•Other programming languages that make useful alternatives are: Visual Basic for Applications, Perl, and Python.
The following limitations must be considered in your client code:
•Be aware that if your client code crashes, instances of StyleVision may still remain in the system.
•Don't hold references to objects in memory longer than you need them, especially those from the XMLData interface. If the user interacts between two calls of your client, then there is no guarantee that these references are still valid.
•Don't forget to disable dialogs if the user interface is not visible.