Rob Beardsworth [MSFT]
Guest
|
Posted:
Mon Aug 01, 2005 8:52 pm Post subject:
RE: I want to use an object COM in .NET to use persistent co |
|
|
The first thing you need to do is try hard to understand what the TLB is
providing to you when you import it into your .NET application. Obviously
you have seen the need to do a tlbimp on your TLB to get a .NET definition
(if you were building this in V.S. it would do that for you when you "add
reference" and select some registered COM object). The ContextArray is
defined to be just a Variant in the COM version of our objects so you need
to create the Array of Objects (using the COM version of the ContextObject)
then tell the call that it is an object (as everything is an object, this
is ok). So:
object [] foo
object bar
// write context to foo
bar = (object) foo
method(...., ref bar)
foo = bar as object []
HTH
Rob Beardsworth
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: "miko"<no.spam@nospam.fr>
Subject: I want to use an object COM in .NET to use persistent connection
in HIS2004
Date: Mon, 1 Aug 2005 05:08:38 -0500
Today, i run successfully the TI Object in .NET to use persistent
connection.
But i don't want to use a web config file.
So i try to use a com object but i have a problem.
i use the COMTICONTEXTLib.dll
i put the tlb in a COM application.
the object appear in a HIS2004 console, i put a remote environment.
first problem resolved
i import the tlb in my program references
when i try tu use directly the method
objBank.cedrbank it doesn't work because i use a complex type
struct ArrayName{
BSTR NAME1;
short NAME2;
BSTR NAME3;
}Array;
the method want system.array and not a cedrbank.ArrayName so in the
compilation i have an
error message 'impossible to convert out cedrbank.ArrayName in out system.
array.
to resolve this problem i make C:\TLB\objBank.tlb /keyfile:C:\Clef\objBank.
snk
/out:C:\TLB\Proxy.objBank.dll After i use the Proxy.objBank.dll and i have
the complex
type.
second problem no resolved
it concern the context.
in the TI object i have a 'ref object[] rgCtxt' so no problem.
in the com object i have a ref object varContextArray (not an array).
when i try to use the method objbank.cedrbank it doesn't work i have an
error message
"impossible to convert 'ref object[]' en 'ref object' because the methode
Write (to open a
connection) need an object[].
Thank you for your help. |
|