C# COM application instance issue
-
Hi All, I am writing a C# application and have exposed COM interfaces. This is all working. My problem is that if I start the application from the command line and then use VB to do a createobject it seems to start another instance of the application. What I want is to get a handle to the already running instance. I have looked around for some time and have not found a solution to this. Can someone please shed some light on this? Thanks, Loren
-
Hi All, I am writing a C# application and have exposed COM interfaces. This is all working. My problem is that if I start the application from the command line and then use VB to do a createobject it seems to start another instance of the application. What I want is to get a handle to the already running instance. I have looked around for some time and have not found a solution to this. Can someone please shed some light on this? Thanks, Loren
Do you have to start it from the command line? Why can't you use CreateObject and the new instance? VB also has a GetObject function, but your COM object has to be in the Running Object Table, and I don't know what that implies for a C# application. You could also look at Enterprise Services, i.e. COM+.
-
Do you have to start it from the command line? Why can't you use CreateObject and the new instance? VB also has a GetObject function, but your COM object has to be in the Running Object Table, and I don't know what that implies for a C# application. You could also look at Enterprise Services, i.e. COM+.
I have an application(C#) that is running on a piece of hardware. I then have a remote user that needs to connect to this application and control it through a COM interface. I have exposed the necessary interfaces and registered it with regasm. My problem is that when the user tries to connect to it with createobject it creates another instance. If they try and use getobject it returns an error saying "runtime error 423. File name or class name not found..." Loren
-
I have an application(C#) that is running on a piece of hardware. I then have a remote user that needs to connect to this application and control it through a COM interface. I have exposed the necessary interfaces and registered it with regasm. My problem is that when the user tries to connect to it with createobject it creates another instance. If they try and use getobject it returns an error saying "runtime error 423. File name or class name not found..." Loren
Loren, I'm afraid I don't have time right now to further investigate COM+, but if you can, what I would recommend is factoring the object required by your remote client into a separate library. Then both your C# application and the remote COM client consume the library through COM+, and there you should be able to limit the instancing of your object. I'll try and find out more, but I'm sure you can as well.
-
Loren, I'm afraid I don't have time right now to further investigate COM+, but if you can, what I would recommend is factoring the object required by your remote client into a separate library. Then both your C# application and the remote COM client consume the library through COM+, and there you should be able to limit the instancing of your object. I'll try and find out more, but I'm sure you can as well.
Thanks Brad...I'll do some more investigating. Currently I am using CoRegisterClassObject(ref myGuid, myApp, ComAPI.CLSCTX_LOCAL_SERVER, ComAPI.REGCLS_MULTIPLEUSE, out myReg) which should have worked but is creating a new instance which generates a new windows form. Loren