VB and VBA Users Source Code: Deterministic Unloading of COM components from .NET applications
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Deterministic Unloading of COM components from .NET applications
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Tuesday, November 19, 2002
Hits:
644
Category:
Visual Basic General
Article:
It is recommended that you do not use the garbage collector to force you COM components to unload, as this will not always work and does not provide a scalable solution (as it affects every .NET assembly running on the machine). Instead use the following to decrement the COM reference counter and hence unload the object: 'Will loop until the reference counter on the variable myComObject is zero Do Loop While System.Runtime.InteropServices.Marshal.ReleaseComObject(myComObject) 'Returns a count of references
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder