![]() |
|
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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... |
|
|||
|
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 |
|
|||
|
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 > |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|