dll that is seen by multiple exe's
-
I need a class that can be seen by multiple running exe's, but have only one instance running. The first program exe that opens will fire up the dll and all others after than will just use it. I want to use this for a licensing situation. We have several front-end exe's that I want to do licensing for. The dll is going to communicate with a licensing server every few mins. If the server goes down, I want the dll to show a warning and close all exe's attached to it after a few mins. I've never had to do anything like this before in c# and am looking for a couple of good ideas. I don't necessarily have to use the dll idea either. As long has I can attach a couple of exe's to the same instance of something in memory and catch a close event or message from it, it should work. Another bad point is that all the exe’s aren’t in .net yet. Some are legacy vb6 still. I don’t know what problems this will entail, but the ideal solution would close them also. I have evaluated several licensing packages and haven’t found one that will do what I want. The ones I can afford won’t and the ones that will do licensing per company are hugely expensive, so I think we have to roll our own. If I could find a licensing package for under around 5K that would probably work also. We looked at flex LM but it’s ridiculously expensive. It would do the per company license scheme we want. (Company a buys 10 licenses, company b 100 etc. A can have 10 computers running my software at one instance in time (as many computers installed, just 10 running at one time), b 100 etc.) Sorry for rambling here :) If you need any other info or clarification let me know. TIA
-
I need a class that can be seen by multiple running exe's, but have only one instance running. The first program exe that opens will fire up the dll and all others after than will just use it. I want to use this for a licensing situation. We have several front-end exe's that I want to do licensing for. The dll is going to communicate with a licensing server every few mins. If the server goes down, I want the dll to show a warning and close all exe's attached to it after a few mins. I've never had to do anything like this before in c# and am looking for a couple of good ideas. I don't necessarily have to use the dll idea either. As long has I can attach a couple of exe's to the same instance of something in memory and catch a close event or message from it, it should work. Another bad point is that all the exe’s aren’t in .net yet. Some are legacy vb6 still. I don’t know what problems this will entail, but the ideal solution would close them also. I have evaluated several licensing packages and haven’t found one that will do what I want. The ones I can afford won’t and the ones that will do licensing per company are hugely expensive, so I think we have to roll our own. If I could find a licensing package for under around 5K that would probably work also. We looked at flex LM but it’s ridiculously expensive. It would do the per company license scheme we want. (Company a buys 10 licenses, company b 100 etc. A can have 10 computers running my software at one instance in time (as many computers installed, just 10 running at one time), b 100 etc.) Sorry for rambling here :) If you need any other info or clarification let me know. TIA
DLLs - be they native libraries or .NET assemblies - are always loaded into the process space. This is how execution works. If you want a singleton pattern in .NET, you can use a well-known singleton object using .NET Remoting. A good place to host this would be in a Windows Service (see
ServiceBase
). If your applications aren't all .NET applications, this is definitely a problem. One thing you might consider is writing a COM+ object with singleton activation. This would make the object available to .NET and native applications, although using it in native applications is a little more difficult. You can read more about COM+ - including how to use it with the .NET Framework - by reading COM+ (Component Services)[^] in the MSDN Library online. You should also read Writing Serviced Components[^] in the .NET Framework and follow the links to class documentation to learn more. You could write this component service in .NET in such a way that it would work for both managed and unmanaged (native) applications and when those latter applications are converted to .NET (if they will be) switch over to .NET Remoting if you like (you would have to, though - it's just a little easier to deploy). This means abstracting the actual licensing code away from the component so that it could be used by either a serviced component or a .NET Remoting object.Microsoft MVP, Visual C# My Articles
-
DLLs - be they native libraries or .NET assemblies - are always loaded into the process space. This is how execution works. If you want a singleton pattern in .NET, you can use a well-known singleton object using .NET Remoting. A good place to host this would be in a Windows Service (see
ServiceBase
). If your applications aren't all .NET applications, this is definitely a problem. One thing you might consider is writing a COM+ object with singleton activation. This would make the object available to .NET and native applications, although using it in native applications is a little more difficult. You can read more about COM+ - including how to use it with the .NET Framework - by reading COM+ (Component Services)[^] in the MSDN Library online. You should also read Writing Serviced Components[^] in the .NET Framework and follow the links to class documentation to learn more. You could write this component service in .NET in such a way that it would work for both managed and unmanaged (native) applications and when those latter applications are converted to .NET (if they will be) switch over to .NET Remoting if you like (you would have to, though - it's just a little easier to deploy). This means abstracting the actual licensing code away from the component so that it could be used by either a serviced component or a .NET Remoting object.Microsoft MVP, Visual C# My Articles