Before I started I saw several posts from people that were struggling to write Media Centre add-ins with VB so I thought there might be some interest in how I eventually made it work.
I used Visual Studio 2003 and Media Center 2005 update rollup 2. I suspect the instructions would be easy to adapt to VS 2005 and Vista but I don't plan to go to Vista in the near future.
The following resources were key on my journey:
1) The Microsoft Windows XP Media Centre Edition 2005 update rollup 2 Software Development Kit currently at http://www.microsoft.com/downloads/details.aspx?FamilyID=1D836C29-ABD5-4FDD-90C5-5C5ABAE97DB4&displaylang=en&Hash=DJHTJ6D.
That's an essential resource, but I did not use either of the techniques suggested for registering add-ins with MCE: RegisterMCEApp.exe; or RegisterAddIn.dll. I found both to be unreliable and - in the end - unhelpful. Instead I used the alternate registration procedure set out in...
2) Anthony Park's page on 'Creating an MCE add-in from soup to nuts at http://www.anpark.com/2006/09/creating-media-center-addin-soup-to.aspx.
This is based on C#, but the approach to registering applications was, for me, much more reliable.
Note that Anthony's example is a background app that starts automatically with MCE. You can use the same technique for an on-demand app by substituting the 'Background' registry key with 'More Programs' and adding an optional 'ImageURL' string value to the entry point GUID below 'EntryPoints'. If you use it, it should point to a 132 by 132 PNG file containing the application logo.
3) The .NET Framework 1.1 configuration tool (available via 'Administrative tools' in the control panel). This allowed me to check whether the application had loaded correctly into the Global Assembly Cache (GAC) and to make sure the key properties were as expected.
4) Lutz Roeder's .NET Reflector available from: http://www.aisto.com/roeder/dotnet/. This was not needed in the development process but it allowed me to explore a working C# application created through Anthony Park's guide with my own VB version. I was able to see my app as C# and Anthony's as VB. That was really helpful and lead me to the last piece in the jigsaw...
5) The following piece of text buried in the middle of a developer fusion article on OO capabilities in VB.NET at http://www.developerfusion.co.uk/show/1047/2/:
"It is also important to remember that VB.NET projects, by default, have a root namespace that is part of the project’s properties. By default this root namespace will have the same name as our project. When we use the Namespace block structure, we are actually adding to that root namespace."
This explained why, when I looked at my app in the Reflector the project name was being added to the front of my Namespace definitions - meaning MCE showed my app but nothing happened when I tried to run it!
The answer was to clear the 'Root namespace' field in the project properties giving me complete control over namespace declarations in my VB code.
I hope that's helpful. Let me know by reply to this article if you need more info.
Andy Henderson
hiya,
just curious, have you started looking at the mcml markup and vb for the vista media center? there's loads of support for C# code, but I'm trying to see if I can get it working with VB. I've created the namespace in my VB code behind, but I can't get the type and schema working properly with the mcml and vb code behind....
Sorry I didn't spot your post. The forum decided at some point that I didn't need to see email notifications!
To answer your question, no I've not got into MCML as yet. I'm still waiting for my Vista upgrade.
Andy