Omar AL Zabir blog on ASP.NET Ajax and .NET 3.5

Working hard to enrich millions of peoples' lives

Sponsors

News

I was
Co-Founder and CTO of Pageflakes, acquired by LiveUniverse - founded by MySpace founder.

I am
Chief Architect, SaaS Platform, British Telecom

I will be
Chief Architect, Mi...

Follow omaralzabir on Twitter

My Public Page
www.pageflakes.com/omar

View Omar AL Zabir's profile on LinkedIn

Read my blog on:

Omar AL Zabir

www.oazabir.com



Views:

Open source projects

Safe COM: Managed Disposable Strongly Typed safe wrapper to late bound COM

There are several problems using COM from .NET:

  • You cannot implement the Dispose pattern by utilizing the "using" block in order to safely dispose COM references.
  • You cannot guaranty COM references are finalized. There's no way to implement "~Destructor()" for COM references.
  • COM reference is not released when a call to Marshal.ReleaseComObject is skipped due to an Exception.
  • When you "Add Reference..." to a COM library, the reference is version specific. So, if you add a reference to the Office 2003 COM library, it does not work properly when deployed to Office 2000.
  • The only solution to version independent COM is to use Late Bound operations but you miss all the features of a strongly typed language.

Let's solve all these problems. We want to use a Managed strongly typed approach to Late Bound COM operations and also utilize the Dispose pattern on COM objects. The solution proposed here works for any COM object which can be Microsoft Office COM libraries, IE & DHTML objects and even your own COM objects. You should use this approach whenever you are dealing with any type of COM library.

If you like this solution, please vote for me.
http://www.codeproject.com/csharp/safecomwrapper.asp

Posted: Oct 25 2007, 02:47 PM by oazabir | with no comments
Filed under: ,

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)