Groups | Blog | Home
all groups > dotnet interop > november 2006 >

dotnet interop : Marshalling VB6 Type


Philipp Brune
11/9/2006 6:36:09 PM
Hello newsgroup,

i have the following problem and i hope someone is able to either tell
me how to solve it or to tell me that it is even not possible :

Given an VB6 ActiveX DLL (Common.dll) that defines the following public
type

Public Type T_DEMO
ID As Integer
Value as String
End Type

Now i reference this dll in my c# library project (NCommon.dll). The IDE
has generated an appropriate Interop.Common.dll.

This NCommon.dll is now COM visible and again referenced by another VB6
standard exe (NCommonClient.exe) project.

In NCommon.dll i can specify a Method like

public void Process(T_DEMO value)
{...}

and I can easily call it from the VB6 NCommonClient and pass an instance
of the T_DEMO type after referencing the corresponding tlb.

What i want to achive is to define the Method like

public void Process(object value)
{

}

into which i want to pass an instance of an UDT and then
cast (appropriate term?) it to the corresponding managed
type from Interop.Common.dll. Is this possible ? From
my vb 6 app i receive the runtime error 5. How could i
do this ?

Thanks in advance,

Philipp


Johannes Passing
11/12/2006 12:00:00 AM
Hi Philipp,

Up to .Net 1.1, Variants containing UDTs cannot be marshalled by default
(see http://support.microsoft.com/default.aspx?scid=kb;en-us;309329).
However, I am not sure if this limitiations still exists in 2.0.

/Johannes

[quoted text, click to view]


--
AddThis Social Bookmark Button