Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mateiacd

Pages: [1]
1
Hi,

I am using Enterprise Architect 12.1.0.1229

I wrote a C# add-in that reads the values of the Repository object, according to the documentation:

http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/availableresources.html
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/eaadd-insea_menuclick.html

I wrote:

Code: [Select]
  public void EA_MenuClick(Repository repository, string location, string menuName, string itemName)
  {
    MessageBox.Show(repository.Authors.Count.ToString());
  }

When I follow these steps:

1. Open an EAP model
2. Call my Add-in from the menu and notice the value of the Authors.Count variable
3. Add or remove an author by following from the menu:  Project | Settings | Project Types | People > Project Author(s)
4. Call my Add-in again and notice the value of  the Authors.Count variable

You will notice that the two values are identical, which is of course incorrect.



 



2
Hello,

I am using Enterprise Architect 12.1.0.1229

I would like to use the Automation API in C# to open an EAP from a mapped network drive, like U:, R: etc

I mention that I have read/write access in these network folders and I also mention that the code works perfectly with models
opened from the local drive C: or from a MySQL database repository.

Using the simple code indicated below:
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/setup.html

  EA.Repository r = new EA.Repository();
  r.OpenFile("U:\\getting-started.eap");
  r.CloseFile();
  r.Exit()

I always get the System.Runtime.InteropServices.COMException  error message:

Quote
An error has occurred: "U:\\getting-started.eap"  isn't a valid path.
Make sure that the path name is spelled correctly and you are connected to the server
on which the file resides.

The Interop.EA.dll version is 2.10.238.1, size 303104 bytes, dated 16.03.2016

3
Hello,

I am using Enterprise Architect 12.1.0.1229

I would like to use the Automation API in Visual C++ 2010. I created a simple Win32 console project.

After trying a simple code like below for a console application, releasing the COM pointer I still see an EA process left running in the Windows task manager.

I am only trying to launch the Enterprise Architect COM server using the EA.App ProgID

HKEY_CLASSES_ROOT\EA.App\CLSID
    {3A9E4F92-8D27-495B-8B22-1D702B3F0C83}

I succeed, but  even after exiting the console application I see the EA.exe *32 in the list of processes

Can anybody help ? Thanks !
Code: [Select]
CoInitialize(NULL);

CLSID clsid;
OLECHAR wb[] = L"EA.App";
CLSIDFromProgID(wb, &clsid);


IDispatch* pDispatch;
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void**)&pDispatch);
if (FAILED(hr))
{
MessageBox(NULL,_T("CoCreateInstance failed"),_T("Enterprise Architect"),MB_OK);
return;
}

pDispatch->Release();
CoUninitialize();

I also tried this variation with the same result. After the application closes, I still have the problem of getting rid of the EA.exe *32 process
Code: [Select]
IUnknown* pUnknown;
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**)&pUnknown);
if (FAILED(hr))
{
    MessageBox(NULL,_T("CoCreateInstance failed"),_T("Enterprise Architect"),MB_OK);
    return;
}


IDispatch* pDispatch;

cout << "Client: Calling QueryInterface() for IDispatch on " << pUnknown << endl;
hr = pUnknown->QueryInterface(IID_IDispatch, (void**)&pDispatch);

if (FAILED(hr))
{
MessageBox(NULL,_T("QueryInterface failed"),_T("Enterprise Architect"),MB_OK);
pUnknown->Release();
return;
}

pDispatch->Release();
pUnknown->Release();


P.S. Can I attach files to this post ? I would like to attach some screen captures.

Pages: [1]