September 25th, 2009, 05:26 PM
Class creation launching another C# exe
I have a .NET forms application that I have created in C#. This forms application is built as an exe and has a set of public interfaces to public classes contained within the exe. Call this exe App1. Question 1: I want all these classes to be non-createable by other .NET applications that call them (similar to the noncreatable attribute in COM). How can I specify this for a .NET C# class?
I now have another .NET forms application that I created in C# as well. Call this exe App2.
Now from within App2 I would like to create an object of one of the types of public classes in App1. This I am able to do with no problem. What I would really like this to do is launch the executable when I create the class from App1 in App2, as opposed to just creating an instance of the class. Question 2: How can I do this?
Background: I am trying to duplicate functionality previously done in a C++ MFC exe with a COM interface. This exe exposed several COM CoClasses, all of which where noncreatable. When an outside application tried to instantiate a new object of one of these COM CoClasses, the exe would actually launch with its associated GUI and message loop and return an interface to that object that was instantiated inside the exe. I would like to replicate this behavior with a C# exe. Unfortunately I am not quite sure how this actually worked in COM, so I really don't know where to start when trying to do this in .NET C#.
Any help would be appreciated. Thanks in advance.
October 11th, 2009, 01:37 PM
Re: Class creation launching another C# exe
Since these two appear to be two different packages, you can declare the constructor as "internal".
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.