[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

How to get an handle on an out-of-process COM component ?

Oriane

7/17/2008 3:56:00 PM

Hi there,

I get a reference on a out-of-process COM (exe) component. The generated
interop dll displays the methods but no constructor is available. So how can
I have an handle on the running component ?

Best regards

7 Answers

Alvin Bruney [ASP.NET MVP]

7/18/2008 1:10:00 AM

0

No difference, make sure your assembly is COM visible and that it has a
public parameterless constructor. With that, you simply new an object on it,
you don't need to call the constructor explicitly in most cases.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Oriane" <oriane@noemail.noemail> wrote in message
news:4F3BF894-8C4D-4478-9581-A608800C7E24@microsoft.com...
> Hi there,
>
> I get a reference on a out-of-process COM (exe) component. The generated
> interop dll displays the methods but no constructor is available. So how
> can I have an handle on the running component ?
>
> Best regards

Oriane

7/18/2008 8:18:00 AM

0

Hi Alvin,
"Alvin Bruney [ASP.NET MVP]" <vapor dan using hot male spam filter> a écrit
dans le message de
news:531E445B-C3CC-4DBF-8372-29C89ABA8437@microsoft.com...
> No difference, make sure your assembly is COM visible and that it has a
> public parameterless constructor. With that, you simply new an object on
> it, you don't need to call the constructor explicitly in most cases.
>
I don't really understand your answer. Which assembly do you talk about ? I
wrote that the Visual Studio 2008 generated assembly has no constructor
(public, private or parameterless...). So the New simply doesn't compile.

Best regards

Oriane

7/18/2008 8:38:00 AM

0

Ok let's rephrase this: the *class* I want to instantiate has no constructor
(of course I don't need an "assembly constuctor" !).

Oriane

7/18/2008 8:59:00 AM

0

With Reflector, I can see an internal parameterless constructor.

Oriane

7/18/2008 9:38:00 AM

0

I think you think I want to expose a .Net assembly as a COM component. What
I want is the exact contrary: I have a COM component and I want to reference
it inside a .net project.

So I have add the COM exe component as a reference on my .net project with
Visual Studio 2008, which produced an interop dll assembly (with tlbimp.exe)
.. I want then to instantiate a .net class inside this assembly, but the only
constructor is internal. So I'm stuck...

Oriane

7/18/2008 11:37:00 AM

0

Finally (and I apologize for these many answers !!!!) I think that the
problem is not on my side. A colleague of mine has made the COM component in
VB 6. How can he change its code to make the classes inside its component
"public" so that "tlbimp.exe" can expose a public non-internal constructor ?

Best regards and many thanks

Alvin Bruney [ASP.NET MVP]

7/19/2008 12:39:00 AM

0

You can't change the code otherwise you would have recompile the dll. If you
add a reference to VB6.dll for instance. In your c# project, add a using
statement > using vb6.dll; In the body of your code do something like
VB6.SomeClass sc = new VB6.SomeClass();
sc.useSomeMethod();

That should work for you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Oriane" <oriane@noemail.noemail> wrote in message
news:37B0F1A6-9A5D-457E-BFBC-B99425081C2D@microsoft.com...
> Finally (and I apologize for these many answers !!!!) I think that the
> problem is not on my side. A colleague of mine has made the COM component
> in VB 6. How can he change its code to make the classes inside its
> component "public" so that "tlbimp.exe" can expose a public non-internal
> constructor ?
>
> Best regards and many thanks
>