Author Topic: Late vs. Early binding of EA COM Objects  (Read 955 times)

prosacom

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Late vs. Early binding of EA COM Objects
« on: November 25, 2003, 06:37:30 am »
Get inspired from VB samples presented in the PDF document "EA automation" it seems to be possible to open a project with this code:
Quote
Public Sub Run()
try
''create the repository object
m_Repository = CreateObject("EA.Repository")
''open an EAP file
m_Repository.OpenFile("F:\Test\EAAuto.EAP")
''use the Repository in any way required
'DumpModel
''close the repository and tidy up
m_Repository.Exit()
m_Repository = Nothing
catch e as exception
Console.WriteLine(e)
End try
End Sub

but at the point I attempt to open the project the function returns false raising an exception upon continuation. Turning in a early binding fashiong things goes successfully:
Quote
Public Sub Run()
Dim m_Repository As New EA.Repository
try
''create the repository object
''open an EAP file
m_Repository.OpenFile("F:\Test\EAAuto.EAP")
''use the Repository in any way required
'DumpModel
''close the repository and tidy up
m_Repository.Exit()
m_Repository = Nothing
catch e as exception
Console.WriteLine(e)
End try
End Sub


What's wrong?

Phil_Bachmann

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: Late vs. Early binding of EA COM Objects
« Reply #1 on: November 26, 2003, 02:07:32 pm »
I pasted both these examples and they worked fine in VB.net.

Could you tell me the text of the exception?

Does the f:\test\eaauto.eap exist?

prosacom

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Late vs. Early binding of EA COM Objects
« Reply #2 on: November 27, 2003, 03:09:44 am »
The error occured with VBA and VBScript (this supports only late binding).
The OpenFile method returns true with Early binding and false with late binding, both with the same EA project. Attepting to continue using the object, the exception is "61704 Internal error".

Thank you

G. Saviane