Connect to the Interface

Return to Introduction  Previous page  Next page

All development environments capable of generating ActiveX Com clients should be able to connect to the Enterprise Architect Automation Interface.

By way of example, the following text describes how to connect using several such tools. The procedure might vary slightly with different versions of these products.

Microsoft Visual Basic 6.0

1.Create a new project.
2.Select the Project | References menu option.
3.Select Enterprise Architect Object Model 2.0 from the list. (If this does not appear, go to the command line and re-register Enterprise Architect using
 
EA.exe /unregister
 
then
 
EA.exe /register).
4.See the general library documentation on the use of Classes. The following example creates and opens a repository object: 

 

Public Sub ShowRepository()

       Dim MyRep As New EA.Repository

       MyRep.OpenFile "c:\eatest.eap"

End Sub

Borland Delphi 7.0

1.Create a new project.
2.Select the Project | Import Type Library menu option.
3.Select Enterprise Architect Object Model 2.0 from the list. (If this does not appear, go to the command line and re-register Enterprise Architect using
 
EA.exe /unregister
 
then
 
EA.exe /register).
4.Click on the Create Unit button.
5.Include EA_TLB in Project1's Uses clause.
6.See the general library documentation on the use of Classes. The following example creates and opens a repository object:

 

procedure TForm1.Button1Click(Sender: TObject);

var

       r: TRepository;

       b: boolean;

begin

       r := TRepository.Create(nil);

       b := r.OpenFile('c:\eatest.eap');

end;

Microsoft C#

1.Select the Visual Studio Project | Add Reference menu option.
2.Click on the Browse tab.
3.Navigate to the folder in which you installed Enterprise Architect (usually Program Files/Sparx Systems/EA) and select Interop.EA.dll.
4.See the general library documentation on the use of Classes. The following example creates and opens a repository object:

 

private void button1_Click(object sender, System.EventArgs e)

{

       EA.Repository r = new EA.RepositoryClass();

       r.OpenFile("c:\\eatest.eap");

}

Java

1.Copy the file SSJavaCOM.dll from the Java API subdirectory of your installed directory (usually Program Files/Sparx Systems/EA) into any location within the Windows PATH. For example, the windows\system32 directory.
2.Copy the eaapi.jar file SSJavaCOM.dll from the Java API subdirectory of your installed directory (usually Program Files/Sparx Systems/EA) to a location in the Java CLASSPATH or where the Java class loader can find it at run time.
3.All of the classes described in the documentation are in the package org.sparx.  See the general library documentation for their use. The following example creates and opens a repository object.

 

public void OpenRepository()

{

   org.sparx.Repository r = new org.sparx.Repository();

   r.OpenFile("c:\\eatest.eap");

}