Introduction

Windows XP Media Center Edition 2005 is an exciting platform for enjoying all of your media from the comfort of your sofa. However, there are many times that you might wish to extend Media Center to perform functionality that it does not have "out of the box." Microsoft has created a software development kit that allows you to write your own software that runs in Media Center. In a previous article, I gave you a broad-brush introduction to creating an HTML application that runs in the 10-foot experience of Windows Media Center. This article will introduce you to the creation of .NET add-ins that are hosted within Media Center. The .NET add-ins allow you to write functional code that can interact with Media Center using your favorite .NET language.

There are two types of .NET add-ins for Media Center:



  • Background--runs at Media Center startup and remains running in the background
  • On-Demand--executed in response to some action from the user
Getting Started

One of the first things you need to know about creating add-ins for Windows XP Media Center Addition 2005 is that they must be written and compiled in .NET 1.0. This is due to the fact that the add-in is hosted by the Media Center process, and that's the only version that Microsoft supports at the present time. This causes many developers a little discomfort, because they are accustomed to working with Visual Studio 2003, which supports only .NET 1.1. However, you can continue to use your existing editor of choice to write the code and then use the .NET compiler on the Media Center computer to compile it. That is the approach that I'll take in this article so that you can get a quick feel for developing an add-in for Media Center without having to install an older version of Visual Studio.


Before we get started, make sure you've downloaded and installed the Media Center Software Developer Kit (SDK).

Required Interfaces

In order to allow your class to interact with Media Center, you need to be familiar with two interfaces:



  • IAddInModule--Media Center uses this interface to trigger your add-in to initialize and uninitialize. It has two methods:

    • Initialize--called when the add-in is first loaded
    • Uninitialize--called when Media Center wants to shut down your add-in

  • IAddInEntryPoint--This is the main interface that Media Center uses when it launches your add-in. All add-ins must implement this interface. It has a single method:

    • Launch--Called after your add-in has been initialized, this is where your primary execution logic should go. Think of it as the old reliable Sub Main in Visual Basic.

[Read More]


 
Comments are closed.