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.


Messages - EspressoE

Pages: [1]
1
Suggestions and Requests / Re: Synchronize Replicas
« on: October 23, 2006, 03:35:24 pm »
I have a similar need for a comparison of different EAP / XML changes to make peer review of changes easier.

The Data Compare / Project compare seems to be doing a comparison of the internal structure of the data.  Is there a way to get a higher-level change list that may include a graphical comparison?

2
Automation Interface, Add-Ins and Tools / Re: C++ and Addins...
« on: December 16, 2005, 02:50:50 pm »
A C++ add-in can be created.  Here's a quick-run-down of the steps:


  • Create an "ATL Project" in Visual Studio .NET (I will assume you used "MyAddIn" throughout the rest of this example).  Make sure that you include MFC support if you want to use AfxMessageBox which is nice for debugging.
  • In the Class View, right click your project name and choose "Add->Add Class"
  • Select "ATL Simple Object" and name your object (I will assume you used "TestClass" throughout the rest of this example).
  • Browse down to the interface for your class (ITestClass)
  • Right click and choose "Add->Add Method"  Fill in the parameters to create the following method.  Note that that last argument will be the retval.

    STDMETHODIMP CTestClass::EA_CONNECT(IDispatch* pRepository, BSTR* szReturn)
    {
       AFX_MANAGE_STATE(AfxGetStaticModuleState());

       CString szTemp(_T("a string"));

       AfxMessageBox(_T("EA_CONNECT called...."));

       *szReturn = szTemp.AllocSysString();

       return S_OK;
    }

  • Now repeat the last steps to make an add-in method as shown below.

    STDMETHODIMP CTestClass::HelloWorld(IDispatch* pRespository, VARIANT* vArgs, VARIANT* vReturn)
    {
       AFX_MANAGE_STATE(AfxGetStaticModuleState());
       CString szTemp;

       AfxMessageBox(_T("Hi from the method HelloWorld"));

       if ( vArgs->vt & VT_ARRAY )
       {
           if ( vArgs->vt & VT_BSTR )
           {   // it's an array of BSTR's
               // TODO:  parse everything here.
               // See http://www.codeproject.com/atl/safearray_macro.asp for guidance
           }

       }

       // Setup the return value
       vReturn->bstrVal = szTemp.AllocSysString();
       vReturn->vt = VT_BSTR;

       return S_OK;
    }

  • Compile the DLL and now add a registry key as follows:

    [HKEY_CURRENT_USER\Software\Sparx Systems\EAAddins\MyAddIn]
    @="MyAddIn.TestClass"

  • Now startup EA and add the following into one of your code templates (you can add as many parameters as you like, they will show up in the vArgs parameter).

    %EXEC_ADD_IN("MyAddIn","HelloWorld","Param1","Param2")%



There you go...  It's simple once you know how :)

-E

Pages: [1]