cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

COM Interface to AOM and .NET

unknown1
1-Newbie

COM Interface to AOM and .NET

Has anybody tried to use the COM interface to epic.exe via a .NET application?

I'm currently still stuck on Epic 4.4. When I try to add a reference to the Epic Type Library in Visual Studio .NET 2003, Visual Studio complains "A reference to 'Arbortext Epic Type Library' could not be added. Converting the type library to a .NET assembly failed. Could not load type Epic.TableSetClass from assembly Interop.Epic, Version=4.4.0.0"

Looks like I'll have to write my cool app in VB6? I've interacted with the Epic Type Library via VB6 just fine in the past. Has anybody out there successfully written a .NET app that used the Epic Type Library (4.4)? How about the Epic 5.1 Type Library?
9 REPLIES 9

Mary,





I have done extensive work with .NET connectivity in 5.1, as well as working with XUI dialogs through .NET.





I have not worked with 4.4 specifically, but we too are currently stuck
using 4.2.1 and I have had no problems calling 4.2.1 from .NET as
well.





Epic 5.1 does provide a .NET DLL (epic.dll in the bin dir) however I'm pretty sure I had to export my own for 4.2.1.





How are you exporting your epic.exe for use in .NET?




Keith Berard

XML Systems Analyst

Milliman Care Guidelines LLC, A Milliman Company

Tel +1 206 381.8166

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care

On 10/5/05, Mary McClure <mary.mcclure@unisys.com
> wrote:
Has anybody tried to use the COM interface to epic.exe via a .NET application?


I'm
currently still stuck on Epic 4.4. When I try to add a reference to the
Epic Type Library in Visual Studio .NET 2003, Visual Studio complains
"A reference to 'Arbortext Epic Type Library' could not be added.
Converting the type library to a .NET assembly failed. Could not load
type Epic.TableSetClass from assembly Interop.Epic, Version=4.4.0.0"

Looks
like I'll have to write my cool app in VB6? I've interacted with the
Epic Type Library via VB6 just fine in the past. Has anybody out there
successfully written a .NET app that used the Epic Type Library (4.4)?
How about the Epic 5.1 Type Library? >> To unsubscribe from the
list, send an email to listmanager@maillist.arbortext.com
with the following in the body: unsubscribe adepters - For additional
information on the adepters list (how to subscribe or unsubscribe etc),
send an email to: listmanager@maillist.arbortext.com with the following in the body: info Adepters - You may also go to
forums.arbortext.com, enter the Adepters folder and change your subscription options and preferences.>>


<br /><br />Mary,<br /><br /><br /><br /><br /><br /><br /><br />We started doing .NET on 4.4H and 5.1. AOM<br />in 5.1 is much more functional. For example, many of the events unavailable in<br />4.4H are available in 5.1. This was important for us because we were trying to<br />minimize ACL code as much as possible. We “absolutely” love .NET<br />here. Our forms behave very Windows-like and the debugger in VS.NET is very<br />good. You should be able to consume unmanaged COM DLL’s in VS.NET. As<br />Mr. Beard has indicated, reference the epic.dll in the bin directory of your<br />Epic install. <br /><br /><br /><br /><br /><br /><br /><br />Incidentally, has anyone here try to<br />deploy a .NET DLL for Epic without registering the DLL? I’m talking to<br />Microsoft and they said “registration-free COM interop” is working<br />only on Windows 2003. Our clients are running XP. They’re researching<br />this issue for us.<br /><br /><br /><br /><br /><br /><br /><br />-Gerald.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /> <br /><br />From: -<br /> On Behalf Of Keith<br />Berard<br /><br />Sent: Thursday, October 06, 2005<br />9:56 AM<br /><br />To: adepters@arbortext.com<br /><br />Subject: Re: COM Interface to AOM<br />and .NET<br /><br /><br /><br /> <br /><br /><br /><br /><br /><br />Mary,<br /><br /><br /><br />I have done extensive work with .NET connectivity in 5.1, as well as working<br />with XUI dialogs through .NET. <br /><br /><br /><br />I have not worked with 4.4 specifically, but we too are currently stuck using<br />4.2.1 and I have had no problems calling 4.2.1 from .NET as well.<br /><br /><br /><br />Epic 5.1 does provide a .NET DLL (epic.dll in the bin dir) however I'm pretty<br />sure I had to export my own for 4.2.1.<br /><br /><br /><br />How are you exporting your epic.exe for use in .NET?<br /><br /><br /><br />Keith Berard<br /><br />XML Systems Analyst<br /><br />Milliman Care Guidelines LLC, A Milliman Company<br /><br />Tel +1 206 381.8166<br /><br />keith.berard@milliman.com<br /><br />http://www.careguidelines.com/<br /><br /><br /><br />Delivering evidence-based knowledge at the point of care <br /><br /><br /><br /> <br /><br />&lt;span&lt;br/&gt;style='font-size:12.0pt'&gt;On 10/5/05, Mary<br />McClure &lt;mary.mcclure@unisys.com<br />&gt; wrote:<br /><br /><br /><br />Has anybody tried to use the COM interface to epic.exe via a .NET<br />application? <br /><br /><br /><br />I'm currently still stuck on Epic 4.4. When I try to add a reference to the<br />Epic Type Library in Visual Studio .NET 2003, Visual Studio complains "A<br />reference to 'Arbortext Epic Type Library' could not be added. Converting the<br />type library to a .NET assembly failed. Could not load type Epic.TableSetClass<br />from assembly Interop.Epic, Version=4.4.0.0"<br /><br /><br /><br /><br />Looks like I'll have to write my cool app in VB6? I've interacted with the Epic<br />Type Library via VB6 just fine in the past. Has anybody out there successfully<br />written a .NET app that used the Epic Type Library (4.4)? How about the Epic<br />5.1 Type Library? &gt;&gt; To unsubscribe from the list, send an email to &lt;a&lt;br/&gt;href="mailto:listmanager@maillist.arbortext.com" target="_blank"&gt;listmanager@maillist.arbortext.com<br />with the following in the body: unsubscribe adepters - For additional<br />information on the adepters list (how to subscribe or unsubscribe etc), send an<br />email to: listmanager@maillist.arbortext.com<br />with the following in the body: info Adepters - You may also go to &lt;a&lt;br/&gt;href="http://forums.arbortext.com" target="_blank"&gt;forums.arbortext.com,<br />enter the Adepters folder and change your subscription options and<br />preferences.&gt;&gt; <br /><br /><br /><br /> <br /><br /><br />

Gerald,



We're pretty much in the same boat as you as far as loving .NET,
preferring to use the API over ACL, and getting frustrated over COM
registration.



The reason we wish to avoid registering COM is to be able to do updates
on the fly to our .NET assembly. To get around the registration
problem, we have created a stub, versioned interface to our assembly
that we can store in the GAC. This assembly is then called by
Epic at startup, and references a config file that then dynamically
loads the latest version of our code.



The obvious drawback to this approach is that the interface must
consistent between updates. However, since we are using the API
and not doing callbacks from ACL, all we need to ensure is that the
assembly is initially run. After that, our assembly can hook into
any document events.



Of course, we still have to register the stub the first time, but after
that all updates can happen through .NET without the need to
re-register.



Keith Berard

XML Systems Analyst

Milliman Care Guidelines LLC, A Milliman Company

Tel +1 206 381.8166

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care

On 10/6/05, Song, Myong S. (Gerald) < songmyos@jicpac.pacom.mil
> wrote:





here. Our forms behave very Windows-like and the debugger in VS.NET is very
good. You should be able to consume unmanaged COM DLL's in VS.NET. As
Mr. Beard has indicated, reference the epic.dll in the bin directory of your
Epic install.





only on Windows 2003. Our clients are running XP. They're researching
this issue for us.









-
[mailto: -] Sent: Thursday, October 06, 2005
9:56 AM

adepters@arbortext.com
</st1Smiley Tongueersonname>

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care






Mary
McClure
< mary.mcclure@unisys.com
> wrote:





reference to 'Arbortext Epic Type Library' could not be added. Converting the
type library to a .NET assembly failed. Could not load type Epic.TableSetClass
from assembly Interop.Epic, Version= 4.4.0.0"




Looks like I'll have to write my cool app in VB6? I've interacted with the Epic
Type Library via VB6 just fine in the past. Has anybody out there successfully
written a .NET app that used the Epic Type Library (4.4)? How about the Epic
5.1 Type Library? >> To unsubscribe from the list, send an email to listmanager@maillist.arbortext.com

with the following in the body: unsubscribe adepters - For additional
information on the adepters list (how to subscribe or unsubscribe etc), send an
email to: listmanager@maillist.arbortext.com
with the following in the body: info Adepters - You may also go to forums.arbortext.com,
enter the Adepters folder and change your subscription options and
preferences.>>






I noticed that I forgot to mention the process I employed to use .NET in 4.2.1.



1) Import the type library to a .NET assembly

tlbimp "c:\program files\epic\bin\epic.exe"



In 4.2.1 this creates an "ADEPT.dll" tlbimp.exe is part of the .NET sdk, though it may be included with Studio as well.



2) You may want to register your Epic as a COM server

epic.exe -regserver



Our editors have gotten so used to the look & feel of Epic's
compare that we now call it programatically. By registering epic,
you avoid having to ensure that the editor is running to do non-gui
(eg: compare) operations through .NET.



On an off note, it's also important to mention that XUI events work
differently than those on the document's DOM, which is not terribly
apparent from the API. That is, only a subset of the w3c spec is
supported for XUI.



Hope that helps,



Keith Berard

XML Systems Analyst

Milliman Care Guidelines LLC, A Milliman Company

Tel +1 206 381.8166

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care

On 10/6/05, Song, Myong S. (Gerald) < songmyos@jicpac.pacom.mil
> wrote:





here. Our forms behave very Windows-like and the debugger in VS.NET is very
good. You should be able to consume unmanaged COM DLL's in VS.NET. As
Mr. Beard has indicated, reference the epic.dll in the bin directory of your
Epic install.





only on Windows 2003. Our clients are running XP. They're researching
this issue for us.









-
[mailto: -] Sent: Thursday, October 06, 2005
9:56 AM

adepters@arbortext.com
</st1Smiley Tongueersonname>

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care






Mary
McClure
< mary.mcclure@unisys.com
> wrote:





reference to 'Arbortext Epic Type Library' could not be added. Converting the
type library to a .NET assembly failed. Could not load type Epic.TableSetClass
from assembly Interop.Epic, Version= 4.4.0.0"




Looks like I'll have to write my cool app in VB6? I've interacted with the Epic
Type Library via VB6 just fine in the past. Has anybody out there successfully
written a .NET app that used the Epic Type Library (4.4)? How about the Epic
5.1 Type Library? >> To unsubscribe from the list, send an email to listmanager@maillist.arbortext.com

with the following in the body: unsubscribe adepters - For additional
information on the adepters list (how to subscribe or unsubscribe etc), send an
email to: listmanager@maillist.arbortext.com
with the following in the body: info Adepters - You may also go to forums.arbortext.com,
enter the Adepters folder and change your subscription options and
preferences.>>






I've recently completed a pop up form in VB.Net which is called from the Epic Menu. It consumes the Epic COM and is capable of inserting tags in the current document. Here is a code snippet which works with VB.Net 2003 and Epic 5.1 (This was converted from an ATI VB6 Example:
Option Strict Off
Option Explicit On
Friend Class EpicCom

' Adept's ACL COM object
Private mACL As Epic.Acl
Private mEpic As Epic.Application

' DOM objects for the current Adept document and the third title in it
Private mCurDoc As Epic.DOMDocument
Private mThirdTitle As Epic.DOMElement

Private WithEvents mdlg As titleDialog
Event NotifyClients(ByVal Data As String)

Private Sub Class_Initialize_Renamed()
' Get Adept's ACL interface
mEpic = New Epic.Application
mACL = mEpic.Acl
mdlg = New titleDialog
End Sub
Public Sub New()
MyBase.New()
Class_Initialize_Renamed()
End Sub

Private Sub Class_Terminate_Renamed()
On Error Resume Next
' Release all of the COM interfaces we got. Probably not really
' necessary, but a good idea.
mEpic = Nothing
mACL = Nothing
mThirdTitle = Nothing
mCurDoc = Nothing
' Unload and release the dialog. If you don't do this, the app
' will never terminate.
mdlg.Close()
mdlg = Nothing
End Sub
Protected Overrides Sub Finalize()
Class_Terminate_Renamed()
MyBase.Finalize()
End Sub

Private Sub mdlg_NotifyClients(ByVal Data As String) Handles mdlg.NotifyClients
' Normally in an Adept environment this event won't be
' handled by anyone, but by a good citizen and raise it anyway
RaiseEvent NotifyClients(Data)
' Set the text in the third title in the document
Dim titleText As Epic.DOMText
titleText = mThirdTitle.FirstChild
If titleText Is Nothing Then
' The title is empty, add a text node to it
titleText = mCurDoc.CreateTextNode(Data)
Call mThirdTitle.InsertBefore(titleText.CloneNode(True), System.DBNull.Value)
Else
' There already is a text node, change it
titleText.NodeValue = Data
End If
' Make the change visible immediately. Without this it won't
' appear in the window until the dialog is closed.
mACL.Execute(("Redisplay"))
End Sub

Public Function ShowDialog(Optional ByVal Modal As Boolean = True) As String
' Find the third title element in the active Adept document
mCurDoc = mACL.DOMDocument(0)
mThirdTitle = FindNthNode((mCurDoc.FirstChild), "title", 3)
Dim text As String
Dim titleText As Epic.DOMText
If Not mThirdTitle Is Nothing Then
titleText = mThirdTitle.FirstChild
If Not titleText Is Nothing Then
text = titleText.NodeValue
End If
mdlg.txtTitle.Text = text
If Modal Then
mdlg.ShowDialog()
ShowDialog = mdlg.txtTitle.Text
Else
mdlg.Show()
End If
End If
End Function

Public Function HideDialog() As Object
mdlg.Hide()
End Function

Private Function FindNthNode(ByRef e As Epic.IDOMNode, ByRef name As String, ByRef number As Short) As Epic.IDOMNode
Dim c As Epic.IDOMNode

FindNthNode = Nothing

If Not e Is Nothing Then
If e.NodeName = name Then
If number <= 1 Then
FindNthNode = e
Else
' This works because VB passes all args by reference by default
number = number - 1
End If
End If

c = e.FirstChild
While ((Not (c Is Nothing)) And (FindNthNode Is

The information about epic.dll was helpful. Apparently, I need to reference epic.dll, not epic.exe.

When I run tlbimp on epic.exe as Mr. Berard suggested, I get the same error message regarding Epic.TableSetClass as I originally posted.

But, if I instead do a Project | Add Reference in Visual Studio .NET and browse to the Epic.DLL, .NET does succesfully add the reference.

But then I'm in another pickle. If I reference the DLL instead of the EXE, how do I declare my referencing objects in my code? My normal "hook-ups" to Epic aren't working anymore:

Epic.Application mEpic = new Epic.Application();
Epic.Acl mACL = mEpic.ACL;

now throws the run-time error:

QueryInterface for interface Epic._Application failed.

Since this is still a DLL that is essentially generated, try doing:



Epic.Application mEpic = new Epic.ApplicationClass();



(or perhaps Epic._Application mEpic = new Epic.ApplicationClass();)



I'd suggest getting a copy of Reflector (http://www.aisto.com/roeder/dotnet/) and load up the Epic.dll



That way you can see the object hierarchy.



Hope that works,



Keith Berard

XML Systems Analyst

Milliman Care Guidelines LLC, A Milliman Company

Tel +1 206 381.8166

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care

On 10/7/05, Mary McClure <mary.mcclure@unisys.com
> wrote:
The information about epic.dll was helpful. Apparently, I need to reference
epic.dll, not epic.exe.

When
I run tlbimp on epic.exe as Mr. Berard suggested, I get the same error
message regarding Epic.TableSetClass as I originally posted.

But,
if I instead do a Project | Add Reference in Visual Studio .NET and
browse to the Epic.DLL, .NET does succesfully add the reference.

But
then I'm in another pickle. If I reference the DLL instead of the EXE,
how do I declare my referencing objects in my code? My normal
"hook-ups" to Epic aren't working anymore:

Epic.Application mEpic = new Epic.Application();

Epic.Acl mACL = mEpic.ACL;

now throws the run-time error:

QueryInterface for interface Epic._Application failed.

Actually, here's some sample code as well.



private Epic._Application app = new Epic.ApplicationClass();

private Epic.IDOMDocument doc = app.ActiveDocument;



Then you can hook up events, eg:

((Epic.IDOMEventTarget)parentDoc).AddEventListener("DOMNodeInserted",this,false);



Or call Acl code:

app.Acl.Execute("mad -before :EditPopup.#1 CITSEP -separator");





Keith Berard

XML Systems Analyst

Milliman Care Guidelines LLC, A Milliman Company

Tel +1 206 381.8166

keith.berard@milliman.com

http://www.careguidelines.com/



Delivering evidence-based knowledge at the point of care

On 10/7/05, Mary McClure <mary.mcclure@unisys.com
> wrote:
The information about epic.dll was helpful. Apparently, I need to reference
epic.dll, not epic.exe.

When
I run tlbimp on epic.exe as Mr. Berard suggested, I get the same error
message regarding Epic.TableSetClass as I originally posted.

But,
if I instead do a Project | Add Reference in Visual Studio .NET and
browse to the Epic.DLL, .NET does succesfully add the reference.

But
then I'm in another pickle. If I reference the DLL instead of the EXE,
how do I declare my referencing objects in my code? My normal
"hook-ups" to Epic aren't working anymore:

Epic.Application mEpic = new Epic.Application();

Epic.Acl mACL = mEpic.ACL;

now throws the run-time error:

QueryInterface for interface Epic._Application failed.

If anybody's interested, I finally got it working. The correct answer is:

1. Reference the DLL, not the EXE.

2. Learn how to instantiate classes in C#. The correct syntax is:

Epic.Application mEpic = new Epic.Application();

Epic.Acl mACL = new Epic.Acl();
Announcements