System.Runtime.InteropServices.Marshal.ReleaseComObject is what you want. -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Pandha Permjeet, Slough Sent: Tuesday, March 23, 2004 9:44 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] COM Interop and freeing references
Hi, I have a .net app that uses a legacy COM Server component built as a VB6 ActiveX Exe. I have added a reference to it using Visual Studio 2003 References menus and can use it perfectly well from my C# app. When the component is used, Windows runs it in a separate process. If you're using this in a VB app then you can simply free the reference by doing a "Set myref = null" and the process automatically disappears. The problem is how can I achieve the same effect in .Net/C#. The component is designed to be activated and released many times during the lifetime of an application, if the reference cannot be freed then you will have many of these processes running. Even if the reference to the component goes out of scope or is set to null it does not release the process. I would think that it would be released if the reference is garbage collected but it is not possible to directly invoke a collection (I've tried GC.Collect() with no effect). Any suggestions? Thanks Permjeet Pandha Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited. =================================== This list is hosted by DevelopMentorR http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com