Launch EA Programmatically

前端 未结 3 1217
有刺的猬
有刺的猬 2021-01-16 21:22

I would like to open an EA session via Windows service and do some action behind the scenes.
I use the Repository API, however, don\'t know how to initialize it correctl

相关标签:
3条回答
  • 2021-01-16 21:35

    Add a reference to Interop.EA.dll and use

    EA.Repository repository = new EA.RepositoryClass();
    
    0 讨论(0)
  • 2021-01-16 21:44

    the code sample below demonstrate how to open EA COM Object and open EA project file then get list of the project models

    // connect to EA COM object     
    EA.Repository _repository = new EA.RepositoryClass();
    // Open EA project file
    bool fileOpened = _repository.OpenFile(filePath);
    if(fileOpened)
       Collection models = _repository.Models; // collection of models inside of opened project
    
    0 讨论(0)
  • 2021-01-16 21:53

    To open a running instance use (C++ example)

    CLSID clsid;
    CLSIDFromProgID(L"EA.App", &clsid);
    IUnknown *pUnk = NULL;
    IDispatch *pDisp = NULL;
    HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pUnk);
    if(SUCCEEDED(hr)) {
      hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pDisp);
    }
    
    0 讨论(0)
提交回复
热议问题