Chapter 32. COM, Native Extensions, and p-invoke

 

This chapter covers

  • COM automation
  • Native Extensions for Silverlight
  • P-invoke

Since the early versions, Silverlight has occupied an interesting space straddling both the web and desktop worlds. Silverlight 3 introduced out-of-browser mode. Silverlight 4 introduced elevated trust and COM automation support. Silverlight 5 capped it all off with support for p-invoke which is used to call native Win32 API-style functions. Pretty amazing for something that started off as a web technology!

In reality, most people developing new Silverlight applications are delivering desktop applications for Windows and use Silverlight for a number of reasons mentioned throughout this book. Those people have asked for more and deeper OS integration in the form of access to COM objects and Win32 API calls. Those same people and others have also implicitly requested these features when they asked for things the Silverlight team wouldn’t have time to deliver but that can be accessed through these mechanisms.

COM automation is good for accessing anything that surfaces an automation interface. The original intent was to enable integration with Microsoft Office, but industrious developers have discovered lots of other automation-capable interfaces in Windows.

32.1. COM automation

32.2. Native Extensions for Silverlight

32.3. P-invoke for API calls

32.4. Summary