PC Review


Reply
Thread Tools Rate Thread

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

 
 
Oriane
Guest
Posts: n/a
 
      17th Jul 2008
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

 
Reply With Quote
 
 
 
 
Alvin Bruney [ASP.NET MVP]
Guest
Posts: n/a
 
      18th Jul 2008
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/Default.aspx
-------------------------------------------------------


"Oriane" <(E-Mail Removed)> wrote in message
news:4F3BF894-8C4D-4478-9581-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Oriane
Guest
Posts: n/a
 
      18th Jul 2008
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-(E-Mail Removed)...
> 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

 
Reply With Quote
 
Oriane
Guest
Posts: n/a
 
      18th Jul 2008
Ok let's rephrase this: the *class* I want to instantiate has no constructor
(of course I don't need an "assembly constuctor" !).

 
Reply With Quote
 
Oriane
Guest
Posts: n/a
 
      18th Jul 2008
With Reflector, I can see an internal parameterless constructor.
 
Reply With Quote
 
Oriane
Guest
Posts: n/a
 
      18th Jul 2008
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...

 
Reply With Quote
 
Oriane
Guest
Posts: n/a
 
      18th Jul 2008
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

 
Reply With Quote
 
Alvin Bruney [ASP.NET MVP]
Guest
Posts: n/a
 
      19th Jul 2008
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/Default.aspx
-------------------------------------------------------


"Oriane" <(E-Mail Removed)> wrote in message
news:37B0F1A6-9A5D-457E-BFBC-(E-Mail Removed)...
> 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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reporting Component that can handle Objects? Joel DaBona Microsoft C# .NET 5 16th Feb 2007 04:15 PM
Component to handle LZH in memory paolol Microsoft C# .NET 4 18th Oct 2006 12:46 PM
How to handle Component error in .NET...? ¿ Mahesh Kumar Microsoft C# .NET 1 15th Sep 2005 05:27 PM
.NET Application Updater Component: how to handle an OCX? DraguVaso Microsoft VB .NET 3 7th Jun 2004 10:04 AM
.NET Application Updater Component: how to handle an OCX? DraguVaso Microsoft Dot NET Framework 2 5th Jun 2004 08:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:01 PM.