Silverlight 4 with COM can do anything – on Windows

At PDC Microsoft played down the significance of adding COM support to Silverlight 4 when run out of the browser and fully trusted (you can also be out of the browser and not fully trusted). The demos were of Office automation, and journalists were told that the feature was there to satisfy the requests of a few Enterprise customers.

Now former Microsoft Silverlight program manager Justin Angel, who has implemented his blog in Silverlight, has spelt out what we all knew, that Silverlight with COM support can do just about anything. His richly-illustrated blog post has code examples for:

  • reading and writing to any file (subject I guess to the permissions of the current user)
  • executing any command or file
  • emulating user input with WShell.SendKeys
  • pinning files to the Windows 7 taskbar
  • reading any registry values
  • adding an application to the Windows startup folder
  • doing text to speech using Windows built-in engine
  • accessing local databases with ODBC
  • automating scanners and cameras
  • using the Windows 7 location API, accessing the full .NET Framework
  • and of course … automating Microsoft Office.

Well, fully trusted means fully trusted; and these are great features for powerful though Windows-only Silverlight applications, though I hope no user installs and trusts one of these applets thinking it is “only Silverlight” and can’t do much harm.

The post also has comments on the lack of any equivalent feature for the Mac in Silverlight 4:       

If Microsoft chooses to not go ahead with Mac support in Silverlight 4 RTM, well, it’s not because they couldn’t

says Angel, suggesting that it would be easy to add AppleScript support. (I had to type that quote – no clipboard support in Silverlight 3).

Of course there is time for Microsoft to unveil such a feature, say at Mix10 in March, though I wouldn’t count on it.

7 thoughts on “Silverlight 4 with COM can do anything – on Windows”

  1. I’m not installing silverlight to view a blog, big fat fail on Justin’s part.

    As far as security goes, I would assume MS has learned by now and will show a big warning dialog for fully trusted apps.

    “pinning files to the Windows 7 taskbar” is not possible even with COM AFAIK (Unless we are talking hacks like using IContextMenu to “click” the pin menu item)

  2. He is talking about using Shell.Application to iterate over shortcut files (.lnk), and execute their verbs which on Windows 7 include “Pin to taskbar”.


  3. that is a hack, there is no API to change the pin list, and applications are not even supposed to try

    Sure; the post is about what Silverlight + COM can do, not what it should do!


  4. Hi Tim, Great Summary. Keep it up.

    @asf, The feature was pinning items to the new Windows 7 Taskbar, not the start menu.
    Which is a fully supported scenario through new Windows 7 Taskbar APIs.

  5. Tim: You might be confusing clipboard support with right-click context menu support. If you use an official Microsoft keyboard, you may find the clipboard functionality conveniently labeled on the “X”, “C”, and “V” keys. Copy-and-paste is working nicely in my own Silverlight 3 app.

Comments are closed.