Introducing COM Automation in Silverlight 4

No.of Views1061
Bookmarked0 times
Downloads 
Votes0
By  Geming Leader   On  27 Mar 2011 11:03:32
Tag : Silver Light and XAML , Applications
In April 2010 Silverlight 4 was released to the world with one of its great features ever, COM-automation support, that allows you to create cutting-edge applications that do everything you can imagine.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 
This article was previously published in my blog, check it out here.

In April 2010 Silverlight 4 was released to the world with one of its great features ever, COM-automation support, that allows you to create cutting-edge applications that do everything you can imagine.

 

What COM is

 

COM (Common Object Model) is a Microsoft technology introduced in 1993 and currently used by many programming languages (including C++ and VB6) for developing and building software components. Simply, you can think about COM as the counterpart for .NET assemblies in languages like C++ and VB6, .NET assemblies hold program objects and so do COM components, there’re many differences of course and one of them is that COM components are much more capable than .NET assemblies and that what makes accessing them is a great improvement to Silverlight.

 

Today there’s much COM components available, Microsoft Office is an example of a COM-based SDK, lots of Windows features are introduced through COM interfaces (Text-to-Speech is a good example,) and lots of 3rd party software (e.g. Adobe Reader) expose their functionalities through COM-based interfaces. Thus, you can’t leave COM automation behind if you’re willing to create cutting-edge Silverlight applications that do almost everything.

 

Silverlight OOB Applications

 

Another great improvement to Silverlight over Adobe Flash is its support for installing and running offline as a desktop application with no network presence. Those Silverlight desktop clients are described as OOB (Out-of-Browser) applications and they have been introduced in Silverlight 3 and extended their functionalities in version 4.

 

OOB applications are sophisticated desktop clients that can run on any platform with no such code changes required. WPF applications are much capable of course but they support only the Windows platform.

 

Notice that COM is a Microsoft technology that won’t run in a non-Windows machine.

 

Silverlight 4 and COM

 

Starting from version 4, you have the ability to call COM-components through your Silverlight application with a small amount of simple and clear code. But don’t expect much, you still constrained by two security restrictions:

 

  1. Your application needs to be running OOB.
  2. Your application must have the Elevated Trust.

Both requirements are easy as two mouse clicks; you simply set application requirements in project properties.

 

Programmatically, to start communicating with a COM component you make use of the AutomationFactory class found in namespace System.Runtime.InteropServices.Automation (exist in the main System.Windows.dll.) Combined the AutomationFactory class with dynamic coding (and the dynamic keyword) you can create your COM objects in Silverlight and play with it.

 

In the next few lessons we’ll discuss Silverlight COM automation in details and see it in action though many useful examples that will move your application to infinity. Enjoy!

 

 
Sign Up to vote for this article
 
About Author
 
Geming Leader
Occupation-Software Engineer
Company-Just Like a Magic
Member Type-Expert
Location-Egypt
Joined date-30 Jul 2009
Home Page-http://WithDotNet.net
Blog Page-http://JustLikeAMagic.com
Independent software developer, trainer, and technical writer from Egypt born in 1991
 
 
Other popularSectionarticles
    Performance is a vital part for any application possibly more important for web based app.With wizard based approach of RIA service generally we tends to comprise all entities, exposing to the client and also allowing the DomainService to go for everything from the database. Not only this approach takes a toll on security, but also it loads the middle tier unreasonably. So this post is about few tips using which we can improve the performance. Well mostly we will cover the Pagination, Limiting
    Published Date : 10/Apr/2011
    My earlier post was about the basic CRUD operations on entities with relation .We had discussed about creating simple association and querying as well as Invoking CRUD operation onto them.As i have mentioned there ,here in this article we will have an in-depth look into Presentation Model and its mode of handling related multiple entities.
    Published Date : 10/Mar/2011
    Silvelight is latest buzz in Microsoft.NET Technologies. Silverlight enable us to create rich user interface for the web based application
    Published Date : 16/May/2010
    This article will demonstrate how to build a traditional master page style application in Silverlight.
    Published Date : 16/Feb/2010
    In the previous lesson we talked about COM automation support introduced in Silverlight 4 and we said that COM automation is available only for Silverlight OOB (Out-of-Browser) applications that have Elevated Trust, and that’s one of the security restrictions imposed by Silverlight. Today, we’re going to talk about COM automation in more details and give few Silverlight examples that make use of this great feature.
    Published Date : 31/Mar/2011
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top