Hosting CLR in VB6 using COM

  • Thread starter Thread starter Damien
  • Start date Start date
D

Damien

Hi guys,

I just found a reference somewhere to the fact that the CLR is usable
from COM, and hence should be usable from VB6. Although I've got no
need to do anything with this yet, I thought I'd have a play with it to
see how it works. So I've created a new VB6 app and added a reference
to mscorlib.tlb in the appropriate framework directory. So I've got a
reference. Woopee. Problem is, I can't figure out what to do with it
now.

For starters, I'd like to load an assembly, instantiate a type and call
a method. But I can't for the life of me see where to start - But where
do I start? What object do I create first?

I am reasonably interested in this since two of our largest systems are
VB classic, and this may be a different migration path to the ones
considered so far (first being to chuck the whole thing at the VB
upgrade wizard, second being to reimplement some functionality into new
DLLs and make them COM callable themselves)

So, anyone done this? Google doesn't seem to be my friend in this case.

Damien
 
Hello Damien,
I just found a reference somewhere to the fact that the CLR is usable
from COM, and hence should be usable from VB6. Although I've got no...

I have a hard time to understand what you are trying to do.
You can create .NET programs that has a COM interface too. But you must
create these in VB.NET, not VB6.
Once created, and assuming that you installed .NET on the computers that
needs to run your program, then you can use that COM in your VB6 projects.

I hope this solves your problem?
 
Olaf said:
Hello Damien,


I have a hard time to understand what you are trying to do.
You can create .NET programs that has a COM interface too. But you must
create these in VB.NET, not VB6.
Once created, and assuming that you installed .NET on the computers that
needs to run your program, then you can use that COM in your VB6 projects.

I hope this solves your problem?

Hi,

Thanks for the response. I've obviously not succeeded in conveying what
I'm trying to do. Essentially, I'm looking at hosting the CLR within a
VB6 application, which would appear to be a possibility because the CLR
is wrapped within a COM library. But I cannot work out where to start
with it. Any hints on this?

Damien
 
Damien said:
Hi,

Thanks for the response. I've obviously not succeeded in conveying what
I'm trying to do. Essentially, I'm looking at hosting the CLR within a
VB6 application, which would appear to be a possibility because the CLR
is wrapped within a COM library. But I cannot work out where to start
with it. Any hints on this?

Damien

Check the site pointed to by Patrice, it contains all info you need to
"host" the CLR in vb6, more precisely
http://msdn.microsoft.com/vbrun/vbfusion/usingnet/default.aspx has a sample
illustrating exactly that. Note that the CLR is loaded whenever you call
into .NET, but I wouldn't call this hosting.

Willy.
 
Back
Top