Problem with com creation in C#
-
I created an activex com object and would like to create an instance in a c# form. when adding the component with the wizard it creates a new instance with "new" end every C# exe gets its one inctance. I am looking for the equivalent C# whay to CoCreate: create the com object only if not exists, get the currantly active instance otherwise. I think the solution lies somware in interop services but failed to find a solution so far....
-
I created an activex com object and would like to create an instance in a c# form. when adding the component with the wizard it creates a new instance with "new" end every C# exe gets its one inctance. I am looking for the equivalent C# whay to CoCreate: create the com object only if not exists, get the currantly active instance otherwise. I think the solution lies somware in interop services but failed to find a solution so far....
C# doesn't have an equivalent to CoCreate, its all hidden behind the interop wrapper. You just have to create an instance of the object in question. If you want a single instance of this object then you need to use a Singleton pattern.
only two letters away from being an asset