Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > .NET Framework

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-17-2008, 03:55 PM
Oriane
 
Posts: n/a
How to get an handle on an out-of-process COM component ?

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
  #2 (permalink)  
Old 07-18-2008, 01:09 AM
Alvin Bruney [ASP.NET MVP]
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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" <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


Reply With Quote
  #3 (permalink)  
Old 07-18-2008, 08:18 AM
Oriane
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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

Reply With Quote
  #4 (permalink)  
Old 07-18-2008, 08:38 AM
Oriane
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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
  #5 (permalink)  
Old 07-18-2008, 08:59 AM
Oriane
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

With Reflector, I can see an internal parameterless constructor.
Reply With Quote
  #6 (permalink)  
Old 07-18-2008, 09:37 AM
Oriane
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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
  #7 (permalink)  
Old 07-18-2008, 11:37 AM
Oriane
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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
  #8 (permalink)  
Old 07-19-2008, 12:38 AM
Alvin Bruney [ASP.NET MVP]
 
Posts: n/a
Re: How to get an handle on an out-of-process COM component ?

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" <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
>

Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > .NET Framework


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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



All times are GMT. The time now is 06:20 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Car Insurance | Real Estate Marketing | MySpace Layouts | Premade MySpace Layouts | Books



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109