<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Michael Creasy's blog : How To</title><link>http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx</link><description>Tags: How To</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How To Build An Add-In For Windows Media Center Edition 2005</title><link>http://blogs.msdn.com/mcreasy/archive/2004/10/12/241449.aspx</link><pubDate>Tue, 12 Oct 2004 21:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:241449</guid><dc:creator>mcreasy</dc:creator><slash:comments>34</slash:comments><comments>http://blogs.msdn.com/mcreasy/comments/241449.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcreasy/commentrss.aspx?PostID=241449</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;How to build an Add-in for Windows Media Center Edition 2005&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;First, the basics...&lt;/p&gt; &lt;p&gt;&lt;strong&gt;What is an Add-in?&lt;/strong&gt;&amp;nbsp; Add-ins are applications written in managed code (.NET Framework 1.0) that run inside Media Center.&amp;nbsp; They have access to the &lt;a href="http://msdn.microsoft.com/mce"&gt;Media Center API&lt;/a&gt; as well as the usual .NET libraries. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;What do I need to build an Add-in?&lt;/strong&gt;&amp;nbsp; Not much really, you could build an add-in using notepad and then compile on the command line.&amp;nbsp; If you want to use a GUI for building an add-in then Visual Studio .NET is the way to go.&amp;nbsp; Note that I recommend using the original version of Visual Studio .NET if you have it not the 2003 release.&amp;nbsp; This is because Media Center uses the 1.0 version of the .NET framework and so you need to compile your add-in to the 1.0 framework as well.&amp;nbsp; Visual Studio .NET 2003 allows you to compile applications against an older framework but not assemblies which is what add-ins are.&amp;nbsp; If you only have the 2003 release of Visual Studio .NET you can still use it to build add-ins but you'll have to use the command line to compile the add-in so you can use the 1.0 version of the compiler.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Creating&amp;nbsp;a very basic add-in&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;First a warning.&amp;nbsp; This add-in does nothing but display a dialog, you can do a lot more than display dialogs; I encourage you to try and avoid displaying dialogs as much as possible as they can be a distraction to the user, especially if they're watching TV.&amp;nbsp; That said, here's the code:&lt;/p&gt;&lt;pre&gt;&lt;font size="4"&gt;&lt;font color="#3366ff"&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; &lt;/font&gt;System; &lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Collections; &lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; Microsoft.MediaCenter.AddIn;&lt;br /&gt; namespace MediaCenter.Sample.AddIn &lt;br /&gt;{ &lt;br /&gt; public class HelloWorldAddIn : MarshalByRefObject, IAddInModule, IAddInEntryPoint &lt;br /&gt; { &lt;br /&gt; &lt;font color="#0000ff"&gt;void &lt;/font&gt; IAddInModule.Initialize(IDictionary dictAppInfo, IDictionary dictEntryPoint) &lt;br /&gt; { &lt;br /&gt; &lt;font color="#009900"&gt;// Write any initialization code here&lt;/font&gt; &lt;br /&gt; } &lt;br /&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; IAddInModule.Uninitialize() &lt;br /&gt; { &lt;br /&gt; &lt;font color="#009900"&gt;// Write any clean up code here&lt;/font&gt; &lt;br /&gt; } &lt;br /&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; IAddInEntryPoint.Launch(AddInHost host) &lt;br /&gt; { &lt;br /&gt; Object[] oButtons = &lt;font color="#0000ff"&gt;new&lt;/font&gt; Object[1]; &lt;br /&gt; oButtons[0] = 1; &lt;br /&gt; host.HostControl.Dialog("Hello World", "My First Add-In", &lt;br /&gt; oButtons,10,&lt;font color="#0000ff"&gt;false&lt;/font&gt;,&lt;font color="#0000ff"&gt;null&lt;/font&gt;,&lt;font color="#0000ff"&gt;null&lt;/font&gt; ); &lt;br /&gt; } &lt;br /&gt; } &lt;br /&gt;}&lt;/font&gt;&lt;/pre&gt; &lt;p&gt;That's how simple it is!&lt;/p&gt; &lt;p&gt;Let me explain the different sections of the code.&amp;nbsp; The add-in implements three interfaces, MarshalByRefObject, IAddInModule and IAddInEntryPoint.&amp;nbsp; The last two are what make an add-in an add-in.&amp;nbsp; You'll need to implement three methods in your add-in as you can see above:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;IAddInModule.Initalize&lt;/strong&gt; - this gets called when the add-in is intialized.&amp;nbsp; When it gets called you're provided with two dictionaries which contain information from the registry - more on those another time. &lt;li&gt;&lt;strong&gt;IAddInModule.Unitialize&lt;/strong&gt; - as you've probably guess from the name, this gets called when the add-in has finished execution it's Launch method and will be shortly before the add-in is unloaded. &lt;li&gt;&lt;strong&gt;IAddInModule.Launch&lt;/strong&gt; - this is where the fun stuff happens - it's the equivalent of "main" in a normal app.&amp;nbsp; When it gets called you're handed an AddInHost object, this object is what lets you access all the Media Center APIs.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This add-in makes use of dialogs that are new to this release of Media Center, the main difference being the ability to include a picture or icon in the dialog - something that I'm not doing in this example.&amp;nbsp; See the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/medctrsdk/htm/hostcontroldialogmethod1.asp"&gt;documentation&lt;/a&gt; for full details of the API call (note I'm using the overloaded version which is docuemented on the lower half of the linked page).&lt;/p&gt; &lt;p&gt;OK, so that's an add-in but that's still not quite everything you'd need to do to build it.&amp;nbsp; Assuming you're using Visual Studio.NET...&amp;nbsp; Use the wizard to create a new C# Class Library (File, New, C#, Class Library) and copy and paste the above code into the file it creates.&amp;nbsp;&lt;/p&gt; &lt;p&gt;The add-in needs to be signed so you'll have to specify a path to a key pair in Assembly.cs, see the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/medctrsdk/htm/creatingstrongnamedaddins.asp"&gt;docs&lt;/a&gt; for the details if you're not familiar with the process.&lt;/p&gt; &lt;p&gt;Now you need to include a reference to the Microsoft.MediaCenter.dll file in order to build the add-in.&amp;nbsp; In the solution explorer right click on References and select "Add Reference..." then browse to c:\windows\ehome and select Microsoft.MediaCenter.dll.&lt;/p&gt; &lt;p&gt;You should now be able to build your add-in.&amp;nbsp; If you need to compile from the command line there are instructions &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/medctrsdk/htm/compilinganaddin.asp"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Now that your add-in is built you need to register it with Media Center.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Registering an add-in&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Registering an add-in is handled by an XML file which contains the registration info and a command line tool called RegisterMCEApp.exe&lt;/p&gt; &lt;p&gt;Here's the XML to register this application:&lt;/p&gt;&lt;pre&gt;&amp;lt;application title="Hello World Add In" id="{CCA64374-182E-43d8-9F7A-6DBBC4AEA4F0}"&amp;gt; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;entrypoint id="{CCA64374-182E-43d8-9F7A-6DBBC4AEA4F1}" addin="MediaCenter.Sample.AddIn.HelloWorldAddIn, HelloWorldAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=43525660dcbb828f, Custom=null" title="Hello World Add In" description="A sample add in for Media Center" &amp;gt; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;category category="More Programs"/&amp;gt; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/entrypoint&amp;gt; &lt;/pre&gt;&lt;pre&gt;&amp;lt;/application&amp;gt;&lt;/pre&gt; &lt;p&gt;There are a couple of parts to the registration file:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;Application tag&lt;/strong&gt; - The application tag has in this example two attributes - title which is the name of the application and an id, this is a GUID which serves as a unique identify for the application. &lt;li&gt;&lt;strong&gt;Entrypoint tag&lt;/strong&gt; - Each application can have multiple entrypoints.&amp;nbsp; An entrypoint corresponds to a place in Media Center that the application can be launched from as specified by the category tag.&amp;nbsp; Each entrypoint must have an id, which is another GUID, but this time is a unique identify of the entrypoint.&amp;nbsp; The entrypoint specifies the full strong name of the assembly which contains the add-in (NOTE: you will need to change the public key token to your public key token for this example to work) and in addition the title of the entrypoint and a description are specified. &lt;li&gt;&lt;strong&gt;Category tag&lt;/strong&gt; - this specifies where in Media Center the application will appear from.&amp;nbsp; This example is launched from More Programs, specifying a category of "Background" would let the add-in be launched automatically when Media Center starts up.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;See the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/medctrsdk/htm/registeringanaddinwithmediacenter.asp"&gt;docs&lt;/a&gt; for more details.&lt;/p&gt; &lt;p&gt;Add your add-in to the GAC using gacutil (note when deploying an add-in you should register the assembly in the GAC at install time using an MSI) - the command line is "gacutil /i &amp;lt;path to assembly&amp;gt;".&lt;/p&gt; &lt;p&gt;The last step is to register the add-in with Media Center.&amp;nbsp; Take the XML sample above and save it as an XML file.&amp;nbsp; Now from a command line run RegisterMCEApp.exe like this:&lt;/p&gt;&lt;pre&gt;RegisterMCEApp.exe &amp;lt;path to xml file&amp;gt;&lt;/pre&gt; &lt;p&gt;Start-up Media Center and go to More Programs, you should see a generic look icon labeled "Hello World Add In", click the icon and the "Hello world" dialog will appear.&lt;/p&gt; &lt;p&gt;That's all there is to it :-)&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.michaelcreasy.com/mediacenter/downloads/helloworldaddin.zip"&gt;Download this sample&lt;/a&gt;. ("Use of included script samples are subject to the terms specified at &lt;a href="http://www.microsoft.com/info/cpyright.htm" target="_blank"&gt;http://www.microsoft.com/info/cpyright.htm&lt;/a&gt;" )&lt;/p&gt; &lt;p&gt;See &lt;b&gt;&lt;a href="http://msdn.microsoft.com/mce"&gt;http://msdn.microsoft.com/mce&lt;/a&gt;&lt;/b&gt; for more info on developing for Media Center.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=241449" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Michael+Creasy_2700_s+Blog/default.aspx">Michael Creasy's Blog</category></item><item><title>Using FindService and PlayMedia to change the TV channel in Media Center</title><link>http://blogs.msdn.com/mcreasy/archive/2004/03/09/86707.aspx</link><pubDate>Tue, 09 Mar 2004 19:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:86707</guid><dc:creator>mcreasy</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/mcreasy/comments/86707.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcreasy/commentrss.aspx?PostID=86707</wfw:commentRss><description>&lt;P&gt;If you've used the MSN TV pages on Online Spotlight in Media Center you might have noticed buttons on some pages to tune to MSNBC or to The Weather Channel.&amp;nbsp; The page uses the Media Center API FindService to find which channel MSNBC is in your particular channel line up and then uses PlayMedia to change the channel (including starting TV if it is not currently in use).&amp;nbsp; Here's a script sample that shows how it works:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;P&gt;&lt;FONT size=2&gt;function watchMSNBC()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var rgServiceIDs = MCE.FindService("msnbc", ""); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (rgServiceIDs.Length == 1) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCE.PlayMedia(0, rgServiceIDs(0));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// MSNBC isn't in the channel listing&amp;nbsp;(or there are multiple channels called MSNBC)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;First of all the code calls FindSerivce with the callsign of the channel, in this case "msnbc", the second parameter is used to find a term in the description of the channel - you'd use this if you wanted to tune to a channel that you didn't know the callsign of - for example you might want to tune to the local ABC channel without having to know the callsign for the channel in each local market.&amp;nbsp; FindService returns an array of channels that match the required attributes; in this case we're assuming that&amp;nbsp;only one channel will be&amp;nbsp;found.&amp;nbsp; &amp;nbsp;Finally we start the channel playing using PlayMedia.&amp;nbsp; The first parameter&amp;nbsp;is the type of media we want to start playing, in this case 0 for TV.&amp;nbsp; The second parameter is the ID of the channel that we want to tune to.&amp;nbsp; Instead of tuning to a particular channel using FindService it's possible to tune to a particular show if it is currently playing using FindProgram, but more on that another time.&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT size=2&gt;This posting is provided "AS IS" with no warranties, and confers no rights.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=86707" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Michael+Creasy_2700_s+Blog/default.aspx">Michael Creasy's Blog</category></item><item><title>Hello World - Media Center Dialogs</title><link>http://blogs.msdn.com/mcreasy/archive/2004/03/02/82782.aspx</link><pubDate>Tue, 02 Mar 2004 18:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:82782</guid><dc:creator>mcreasy</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/mcreasy/comments/82782.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcreasy/commentrss.aspx?PostID=82782</wfw:commentRss><description>&lt;P&gt;The Media Center API has a function to displays dialogs, similar to the ones Media Center uses itself.&amp;nbsp; An HTML application can take advantage of these to ask the user a question, or simply display a notification.&amp;nbsp; Here's a simple example of how to create one:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&amp;lt;HTML&amp;gt;&lt;BR&gt;&amp;lt;BODY BGColor="#0121BA"&amp;gt;&lt;BR&gt;&amp;lt;SCRIPT&amp;gt;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function IsMCEEnabled()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var MCE, Message, Caption, Timeout, Buttons, Modal, ReturnValue&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCE = window.external.MediaCenter();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Caption = "Hello World";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Message = "This is a Media Center Dialog";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timeout = 10;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Buttons = 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Modal = true;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReturnValue = MCE.Dialog(Message, Caption, Buttons, Timeout, Modal);&lt;BR&gt;&amp;lt;/SCRIPT&amp;gt;&lt;BR&gt;&amp;lt;/BODY&amp;gt;&amp;nbsp;&lt;BR&gt;&amp;lt;/HTML&amp;gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;Lets take a look at what this does.&amp;nbsp; First I've implemented a function called IsMCEEnabled, this lets Media Center know that the page was designed for Media Center.&amp;nbsp; Next I've declared the variables I'll be using to create my dialog and finally I've created the dialog itself.&amp;nbsp; The usage of most of the parameters in the Dialog function are obvious, but some need a little bit of explanation.&amp;nbsp; "Buttons" is a number that corresponds to the buttons to be displayed on the dialog in the following way:&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px" align=center&gt;
&lt;TABLE id=Table1 cellSpacing=1 cellPadding=1 width=200 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD align=middle&gt;Value&lt;/TD&gt;
&lt;TD align=middle&gt;Button&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align=middle&gt;1&lt;/TD&gt;
&lt;TD&gt;OK button&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align=middle&gt;2&lt;/TD&gt;
&lt;TD&gt;Cancel button&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align=middle&gt;4&lt;/TD&gt;
&lt;TD&gt;Yes button&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align=middle&gt;8&lt;/TD&gt;
&lt;TD&gt;No button&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;Combining the values allows you to specify multiple buttons, for example if "Buttons" had a value of 3 then an OK button and a Cancel Button would be created on the dialog, 5 would put an OK button and a Yes button on the dialog.&amp;nbsp; &lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;"Timeout" is a value in seconds that the dialog is displayed for, in this case ten seconds.&amp;nbsp; Setting the value to 0 will display a modal dialog until it's dismissed by the user, for a non-modal (also called modeless and semi-modal) dialog it will disappear five seconds.&amp;nbsp; Whether a dialog is modal (center of the display and blocks access to the page behind it and prevents and navigation) or non-modal (appears at the bottom of the display and doesn't prevent access to the page or navigation) is controlled by a boolean which in this case I've named "Modal" - true creates a modal dialog and false a non-modal dialog.&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;Finally there's the return value of the Dialog function - this lets the page know what button a user pressed on the dialog, or if the dialog closed as a result of the timeout - note this only applies to modal dialogs, non-modal dialogs always return the same value because they are displayed asynchronously - so the return value will be created while the dialog is still on the screen, for this reason non-modal dialogs are best used for notification purposes.&amp;nbsp; Modal dialogs on the other hand block further script execution on the page until the user responds to them or the timeout occurs.&amp;nbsp; The return values fall into the following categories:&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px" align=center&gt;
&lt;TABLE id=Table2 cellSpacing=1 cellPadding=1 width=300 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;Value&lt;/TD&gt;
&lt;TD align=middle&gt;Action&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;0&lt;/TD&gt;
&lt;TD&gt;OK button was pushed&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;1&lt;/TD&gt;
&lt;TD&gt;Cancel button was pushed&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;2&lt;/TD&gt;
&lt;TD&gt;Yes button was pushed&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;3&lt;/TD&gt;
&lt;TD&gt;No button was pushed&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;5&lt;/TD&gt;
&lt;TD&gt;The dialog closed due to the timeout&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 54px" align=middle&gt;6&lt;/TD&gt;
&lt;TD&gt;Dialog displayed (non-modal dialogs)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;That's all there is to it!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=82782" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Michael+Creasy_2700_s+Blog/default.aspx">Michael Creasy's Blog</category></item><item><title>Creating a web page that's designed for Media Center (part one)</title><link>http://blogs.msdn.com/mcreasy/archive/2004/02/23/78723.aspx</link><pubDate>Mon, 23 Feb 2004 22:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:78723</guid><dc:creator>mcreasy</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/mcreasy/comments/78723.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcreasy/commentrss.aspx?PostID=78723</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://blogs.msdn.com/mcreasy/archive/2004/02/03/66732.aspx"&gt;Previously I wrote about creating a MCL&lt;/A&gt; file to point to a web page so it could be viewed in Media Center.&amp;nbsp; This time I'm going to explain how to create a web page that is designed for use in Media Center.&lt;/P&gt;
&lt;P&gt;Web pages for Media Center need to be designed with a number of factors in mind:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The page will be viewed from 10', not 2' foot like a normal page
&lt;LI&gt;The user may not have a keyboard and mouse - they may just have a remote control
&lt;LI&gt;The display device might be a TV not a monitor, so the user may be unable to see the edges of your page due to overscan&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Lets start by creating a basic page.&amp;nbsp; Use Notepad (or your text editor of choice) to create a new HTML file that looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;P&gt;&amp;lt;HTML&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SCRIPT&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function IsMCEnabled()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/SCRIPT&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;P&amp;gt;Hello Media Center&amp;lt;/P&amp;gt;&lt;BR&gt;&amp;lt;/HTML&amp;gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;Now &lt;A href="http://blogs.msdn.com/mcreasy/archive/2004/02/03/66732.aspx"&gt;create a MCL file &lt;/A&gt;that points to this new page and place it in "c:\documents and settings\all users\start menu\programs\accessories\media center\media center programs\".&amp;nbsp; Start up Media Center and in More Programs you should find a link to your page.&amp;nbsp; Click the link and you'll see your page.&amp;nbsp; You'll have noticed that you didn't get a warning message about the page not being designed for Media Center when the page was displayed.&amp;nbsp; That's because we included that little fragment of script.&amp;nbsp; When Media Center loads the page it checks to see if a function called IsMCEEnabled is defined and calls it to see if it returns true.&amp;nbsp; If the function returns true then Media Center knows the page has been designed for Media Center and if not it displays that warning message.&lt;/P&gt;
&lt;P dir=ltr&gt;So now we have a page that Media Center can easily display.&amp;nbsp; It doesn't look very good from a distance though, so lets do something about that.&amp;nbsp; Edit the file and change&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&amp;lt;P&amp;gt;Hello Media Center&amp;lt;/P&amp;gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;to&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&amp;lt;P style="FONT-SIZE: large"&amp;gt;Hello Media Center&amp;lt;/P&amp;gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;Now when viewing the page in Media Center the text should be readable from a distance, it's still stuck in the top left corner of the page and might not be visible to a user viewing the page on a TV.&amp;nbsp; Move it down and to the right slightly by changing the line to be:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;P&gt;&amp;lt;DIV style="DISPLAY: inline; LEFT: 30px; WIDTH: 208px; &lt;BR&gt;POSITION: absolute; TOP: 30px; HEIGHT: 32px"&amp;gt;&lt;BR&gt;&amp;lt;P style="FONT-SIZE: large"&amp;gt;Hello Media Center&amp;lt;/P&amp;gt;&amp;lt;/DIV&amp;gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;Suddenly it looks much more complex, but all we've done is add a &amp;lt;DIV&amp;gt; tag the specifies a region on the page and displays the text there.&amp;nbsp; If you use an editor such as Visual Studio you can create these elements automatically by using the HTML Label component in the toolbox.&amp;nbsp; FrontPage has similar functionality.&amp;nbsp; View this page in Media Center now and you'll see the text has moved and should be easier to see.&lt;/P&gt;
&lt;P dir=ltr&gt;That's enough for part one for now.&amp;nbsp; The &lt;A href="http://www.microsoft.com/windowsxp/mediacenter/developer/"&gt;SDK &lt;/A&gt;has some samples of HTML pages if you can't wait for part two which will include steps to enable the use of the remote control to navigate a page.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=78723" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Michael+Creasy_2700_s+Blog/default.aspx">Michael Creasy's Blog</category></item><item><title>Creating links to web pages to view in Media Center</title><link>http://blogs.msdn.com/mcreasy/archive/2004/02/03/66732.aspx</link><pubDate>Tue, 03 Feb 2004 20:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:66732</guid><dc:creator>mcreasy</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/mcreasy/comments/66732.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcreasy/commentrss.aspx?PostID=66732</wfw:commentRss><description>&lt;P&gt;In Media Center there's a page called &amp;#8220;More Programs&amp;#8221; that contains links to applications that have been installed for use in Media Center.&amp;nbsp; It's easy to add a link on that page to a web page that you might want to view from Media Center, perhaps the current traffic conditions (very useful in Seattle) or the weather forecast (normally rain in Seattle).&lt;/P&gt;
&lt;P&gt;Links are stored as MCL files that contain a small bit of XML that looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;lt;application url="&lt;/FONT&gt;&lt;A href="http://server/path/page.html"&gt;&lt;FONT face="Courier New"&gt;http://server/path/page.html&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Courier New"&gt;" name="Name of the page"&lt;BR&gt;bgcolor="RGB(1,33,186)"&lt;BR&gt;startimage=".\StartImage.png"&lt;BR&gt;thumbnailImage=".\thumbnailImage.png"&lt;BR&gt;sharedviewport="false"&amp;gt;&lt;BR&gt;&amp;lt;/application&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Set the url to the page you want to use and change the name to the name you want to appear in &amp;#8220;More Programs&amp;#8221; - You can also specify a path to a PNG file to use as a thumbnail in the thumbnailImage and startimage attributes.&amp;nbsp; The image referenced by thumbnailImage will appear in &amp;#8220;More Programs&amp;#8220; as the link your page and the one referenced by startimage will appear on the Media Center start page if your link appears there.&amp;nbsp; bgcolor specifies the background colour of Media Center (in this case a shade of blue similar to the one Media Center uses) - this will appear around the shared view port and around the transport controls that appear when you move your mouse - you can set it to any RGB value.&amp;nbsp; The shared view port is the area of the display that video and music appear in when they are not the primary experience - it appears in the lower left corner of the display.&amp;nbsp; You can tell Media Center to show or hide the shared view port while you are viewing the page you are linking to by setting the property to true or false.&amp;nbsp; In this case false is probably the best option as the page you are linking to will not be designed for Media Center and so the shared view port will hide some of the information on the page.&amp;nbsp; Don't worry though, your media will continue to play.&lt;/P&gt;
&lt;P&gt;Now that you've created your MCL file you need to place it somewhere that Media Center can find it&amp;nbsp; That place is &amp;#8220;c:\documents and settings\all users\start menu\programs\accessories\media center\media center programs\&amp;#8220;.&amp;nbsp; You can also get to this folder from the Start menu by clicking the Start button, then All Programs, Accessories, Media Center and then right clicking on &amp;#8220;Media Center Programs&amp;#8220; and clicking &amp;#8220;Open&amp;#8220;.&lt;/P&gt;
&lt;P&gt;You can now view the page you've linked to by starting Media Center and going to &amp;#8220;More Programs&amp;#8220; from the start page and you should see a link with the thumbnail image you specified (if you specified one - you don't have to).&amp;nbsp; Click the link to go to the page.&amp;nbsp; You'll probably be presented with a dialog saying that the page isn't designed for Media Center.&amp;nbsp; If you click &amp;#8220;View Now&amp;#8220; you'll see the page right away, and if you click &amp;#8220;View Later&amp;#8220; a link will be created on your desktop so you can go to the page later.&amp;nbsp; Pages that aren't designed for Media Center may not display very well when using a TV as a display and may be difficult to read from a distance.&amp;nbsp; I'll cover how to design a page for Media Center in a future post.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=66732" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcreasy/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://blogs.msdn.com/mcreasy/archive/tags/Michael+Creasy_2700_s+Blog/default.aspx">Michael Creasy's Blog</category></item></channel></rss>