Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 C# ActiveX
Hello everyone,

My previous question was maybe not so good formulated.
I will explain my query as follow:

Do you know how to simulate in C#, a VB6 Activex EXE Standalone application which exposes a com visible object (IDispatch wrapper class) already instanced in the 'activex exe like' c# application? The clients accessing it via creatobject / getobject will always get a reference on this object.

This does not seem to be so straight forward as I experimented in vb.net.
Is it related to .net interop ?

If I understand the best way will be to expose a .NET Remoting object (application life time) then creating a COM interop class library which will be used like a tunnel between the two communication solutions.
 
Is it what you have in mind ?
 
Hope this will help you to understand my question.

Any inputs you could share for this are really welcome ?
 
Thank you so much in advance.
Posted 26-Oct-11 7:33am
Edited 26-Oct-11 23:41pm
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The closest equivalent would be a Windows service that exposes a WCF service (or remoting) interface.
 
That said you could use COM interop to consume your VB6 ActiveX exe directly if you so prefer.
  Permalink  
Comments
Espen Harlinn at 26-Oct-11 20:12pm
   
Good reply :)
SuperMiQi at 27-Oct-11 4:40am
   
Hello,
 
If I understand the best way will be to expose a .NET Remoting object (application life time) then creating a COM interop class library which will be used like a bridge/connection between the two communications solution.
 
Is it what you have in mind ?
Thank you so much in advance.
SuperMiQi at 27-Oct-11 5:05am
   
If I understand the best way will be to expose a .NET Remoting object (application life time) then creating a COM interop class library which will be used like a tunnel between the two communication solutions.

Is it what you have in mind ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First, the term "static object" is a misnomer. A static class cannot be instantiated in .Net.
You can expose a static method or class in .Net.
 
Instead of CreateObject you can use the new keyword and that will create an instance of a class for you.
 
In case you don't want to do all this, you can still use your ActiveX dll in C# using Com Interop[^].
  Permalink  
Comments
SAKryukov at 26-Oct-11 14:52pm
   
Abhinav, where did you see "static object" in the question? Please understand, "static object" is not a misnomer, but "object of static class" would be. These too things are not the same; and a static object is a usual thing. But who mentioned this object of static class?
--SA
SAKryukov at 26-Oct-11 14:56pm
   
OK, I looked at the first version of the OP's question and found a mention of "static object" there. No, there is nothing fundamentally wrong with this idea. Of course, practically, exposing of a static object by a class library is quite a bad design, but not a misnomer or something. (So, I did not vote this time.)
--SA
Abhinav S at 27-Oct-11 1:03am
   
Ok. I still don't quite get the concept static object.
How will you generate a 'static object'? Anyway, we might actually digressing away from the OP's initial question a little.
SuperMiQi at 27-Oct-11 5:06am
   
If I understand the best way will be to expose a .NET Remoting object (application life time) then creating a COM interop class library which will be used like a tunnel between the two communication solutions.

Is it what you have in mind ?
Espen Harlinn at 26-Oct-11 20:14pm
   
Nice reply :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 255
3 Shweta N Mishra 216
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 27 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100