|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can you emulate an ActiveX exe in .NETI'm currently working on converting an ActiveX exe that was written in VB6 to VB.NET. The original application was written as a TSR which lives in the system tray providing integration between a web site and 3rd party windows apps (such as MS office, etc...). I've managed to convert the application to .NET originally using the upgrade wizard (to get it up to .NET 1.1 and finally up to .NET 2) and then rewriting a fair bit of the code. However, I'm having a few difficulties getting the application to run like the old ActiveX exe. Basically what I want is for this application to: a.) provide a COM interface b.) stay resident so that other apps can call it c.) run as a single instance application (i.e. new apps that call the program shouldn't start a new instance but should be able to hook into the running instance). I've compiled the application as a DLL / assembly and given it a COM interface, however at present whenever an app tries to talk to the TSR it starts another instance of it rather then just hooking into the original instance. Would anyone have some ideas on how to achieve what I want with VB.NET. Thanks in advance! VB2005 allows you to easily set your app to be single instance in the
project properties. Not sure if there's some other mechanism to it. Between .NET apps, the only way to mimic the behavior of ActiveX servers is to use Remoting (which is not as hard as it first seems) even on the same machine. Show quoteHide quote "Mike" <mjmcma***@gmail.com> wrote in message news:1140757562.409700.74250@e56g2000cwe.googlegroups.com... > Hi there, > > I'm currently working on converting an ActiveX exe that was written in > VB6 to VB.NET. The original application was written as a TSR which > lives in the system tray providing integration between a web site and > 3rd party windows apps (such as MS office, etc...). > > I've managed to convert the application to .NET originally using the > upgrade wizard (to get it up to .NET 1.1 and finally up to .NET 2) and > then rewriting a fair bit of the code. However, I'm having a few > difficulties getting the application to run like the old ActiveX exe. > Basically what I want is for this application to: > > a.) provide a COM interface > b.) stay resident so that other apps can call it > c.) run as a single instance application (i.e. new apps that call the > program shouldn't start a new instance but should be able to hook into > the running instance). > > I've compiled the application as a DLL / assembly and given it a COM > interface, however at present whenever an app tries to talk to the TSR > it starts another instance of it rather then just hooking into the > original instance. > > Would anyone have some ideas on how to achieve what I want with VB.NET. > > > Thanks in advance! > Well with Remoting you can cross the aplication domain boundary`s
i found this book to be verry helpfull http://www.amazon.com/gp/product/0735619336/sr=8-2/qid=1140770529/ref=pd_bbs_2/002-6114261-2231201?%5Fencoding=UTF8 you can do what you want by creating a singleton component however a.) provide a COM interface ' afaik this will start a new instance , so if you component is running as remoting component and a legacy app connects through the com interface a new instance is created b.) stay resident so that other apps can call it override the InitializeLifetimeService Public Overrides Function InitializeLifetimeService() As Object Return Nothing End Function c.) run as a single instance application (i.e. new apps that call the program shouldn't start a new instance but should be able to hook into the running instance). this is standard behavior of a remoting singleton The problem i am facing is that i would like to pass a gui to a win32 app as you can with a ActiveX exe this doesn`t seem to be possible with .Net without creating memory leaks etc etc regards Michel Posseth [MCP] Show quoteHide quote "Mike" <mjmcma***@gmail.com> wrote in message news:1140757562.409700.74250@e56g2000cwe.googlegroups.com... > Hi there, > > I'm currently working on converting an ActiveX exe that was written in > VB6 to VB.NET. The original application was written as a TSR which > lives in the system tray providing integration between a web site and > 3rd party windows apps (such as MS office, etc...). > > I've managed to convert the application to .NET originally using the > upgrade wizard (to get it up to .NET 1.1 and finally up to .NET 2) and > then rewriting a fair bit of the code. However, I'm having a few > difficulties getting the application to run like the old ActiveX exe. > Basically what I want is for this application to: > > a.) provide a COM interface > b.) stay resident so that other apps can call it > c.) run as a single instance application (i.e. new apps that call the > program shouldn't start a new instance but should be able to hook into > the running instance). > > I've compiled the application as a DLL / assembly and given it a COM > interface, however at present whenever an app tries to talk to the TSR > it starts another instance of it rather then just hooking into the > original instance. > > Would anyone have some ideas on how to achieve what I want with VB.NET. > > > Thanks in advance! > > Basically what I want is for this application to: It sounds like you want a single instance winform application or windows > > a.) provide a COM interface > b.) stay resident so that other apps can call it > c.) run as a single instance application (i.e. new apps that call the > program shouldn't start a new instance but should be able to hook into > the running instance). service. I have a write-up of single instance winforms with 1.x and 2.0 at http://devauthority.com/blogs/jwooley/archive/2005/07/28/318.aspx. Jim Wooley after reading the article
No that is not what he wants with VB6 it is possible to creat a so called out of process component ( Activex executable ) when this one process is running multiple clients can connect to this one sole instance . In VB.Net this is only possible with Remoting using a singleton , however then you miss the interop with this functionality to legacy apps and you can`t pass guis to these clients ( wich could be done in VB6 ) regards Michel Posseth Show quoteHide quote "Jim Wooley" <jimNOSPAMwooley@hotmail.com> schreef in bericht news:24f81e8e0cb38c8073e10c9d849@msnews.microsoft.com... >> Basically what I want is for this application to: >> >> a.) provide a COM interface >> b.) stay resident so that other apps can call it >> c.) run as a single instance application (i.e. new apps that call the >> program shouldn't start a new instance but should be able to hook into >> the running instance). > > It sounds like you want a single instance winform application or windows > service. I have a write-up of single instance winforms with 1.x and 2.0 at > http://devauthority.com/blogs/jwooley/archive/2005/07/28/318.aspx. > Jim Wooley > >
object reference not set to an instance???
possible to create one control array with different controls? vb2005 propertybag User "sticky" profile After export to Excel, that excel cannot open Late binding equivalent "The path is not of a legal form" error - WinFoms designer dealing with images of varing sizes on a form. Field token out of range (System.BadImageFormatException) VB 'Phone Home' |
|||||||||||||||||||||||