Book a Demo

Author Topic: How to add COM reference to project?  (Read 4011 times)

aquila2005

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
How to add COM reference to project?
« on: August 08, 2007, 04:12:24 am »
Hello

I am new to EA (using version 6.1) and I find it very effecient... As an ex-Rational Rose user when I created my VB.Net class I was expecting to find a menu option to import the definition (from the .dll or the .olb file) of the COM objects I need to inherit from (implemented in my class)...

I was expecting EA to automatically add thhe the method I need to implement in my class...

But how to add these COM references to my project???

I can only import XML stuff! Is there a way to do this? Import a COM library (olb file) into a project and use all the COM objects defined therein to build my own COM classes (you guessed that I need to implement and add functions to existing COM classes)

any help will be much appreciated..

thanks.



«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add COM reference to project?
« Reply #1 on: August 08, 2007, 05:48:07 am »
When you create a COM library in .Net, you need to set some attributes to make the classes, attributes and methods visible to COM.

I don't have them in front of me, but you will find the necessary information in the .Net help, or you can create a COM library - this is not the same as a 'normal' class library - and inspect the code. You might also see what you need by inspecting something like a COM wrapper in the VS Object Browser.

Having done that, you might be successful.

HTH, David

PS: If you are simply trying to reverse engineer a COM application, you are (almost) out of luck. EA will only do this with .Net and Java libraries. But...

Try creating a .Net interop assembly for your COM object. You should be able to reverse that, and will likely get something usable.
No, you can't have it!

aquila2005

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to add COM reference to project?
« Reply #2 on: August 08, 2007, 06:56:15 am »
hmmmm

I see... I was expecting a tool to import COM definition (.idl file or .olb or even .dll) directly into EA.

For exemple, I am using ESRI.ArcGIS.Geodatabase in my .Net VB class. I would like to represent a COM class from that library as a "imported object" I could then use as aggregate or even to inherit from and build my classes... I even hoped it would automatically add all the method I need to override when I implement a COM interface...

AS I said, I am new to Ea, so I'll continue playing around...

thanks

thomaskilian

  • Guest
Re: How to add COM reference to project?
« Reply #3 on: August 08, 2007, 02:43:42 pm »
Try the Import Binary from the Package Context Code Engeneering menu.

aquila2005

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to add COM reference to project?
« Reply #4 on: August 09, 2007, 02:31:24 am »
that looks more like what I had in mind...
expect finding the .dll that matches the .olb is prooving difficult... but I'll get to it :)

once imported, where are the classes??? I was expecting EA to create a new model or package and to see all the classes created nicely displayed with relationship etc...

thanks for your help...


thomaskilian

  • Guest
Re: How to add COM reference to project?
« Reply #5 on: August 09, 2007, 07:15:35 am »
AFAIK they are imported in the package where you invoke the context menu. You should have had open a class diagram within that package as the imported elements are place on this very diagram. EAUI

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to add COM reference to project?
« Reply #6 on: August 09, 2007, 01:02:40 pm »
The binary importer doesn't support importing COM.  It only supports Java and .Net.  If want a different type of format handled I recommend you send in a feature request.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to add COM reference to project?
« Reply #7 on: August 09, 2007, 01:16:14 pm »
Actually one workaround to import COM into EA is to use tlbimp to import a COM engine and generate a .NET assembly RCW.

The .NET assembly can then be imported into EA.

I was going to claim that I haven't actually done this, but I can do better.  The results of doing this can be seen by at http://sharepoint.standardcase.com/external/eaug/Shared%20Documents/Forms/AllItems.aspx or by downloading the following and importing it into EA. http://sharepoint.standardcase.com/external/eaug/Shared%20Documents/Interop.EA.dll.xmi.zip

aquila2005

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to add COM reference to project?
« Reply #8 on: August 10, 2007, 02:13:53 am »
thanks.

That is working as expected. I can import COM objects and .Net assembly.

Thanks again for all your help.

a+